File tree 1 file changed +2
-15
lines changed
elasticsearch-model/examples
1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change @@ -50,20 +50,7 @@ def as_indexed_json(options={})
50
50
puts "Article search:" . ansi ( :bold ) ,
51
51
response_1 . to_a . map { |d | "Title: #{ d . title } " } . inspect . ansi ( :bold , :yellow )
52
52
53
- response_2 = Article . __elasticsearch__ . client . suggest \
54
- index : Article . index_name ,
55
- body : {
56
- articles : {
57
- text : 'foo' ,
58
- completion : { field : 'title.suggest' }
59
- }
60
- } ;
61
-
62
- puts "Article suggest:" . ansi ( :bold ) ,
63
- response_2 [ 'articles' ] . first [ 'options' ] . map { |d | "#{ d [ 'text' ] } -> #{ d [ '_source' ] [ 'url' ] } " } .
64
- inspect . ansi ( :bold , :green )
65
-
66
- response_3 = Article . search \
53
+ response_2 = Article . search \
67
54
query : {
68
55
match : { title : 'foo' }
69
56
} ,
@@ -76,7 +63,7 @@ def as_indexed_json(options={})
76
63
_source : [ 'title' , 'url' ]
77
64
78
65
puts "Article search with suggest:" . ansi ( :bold ) ,
79
- response_3 . response [ 'suggest' ] [ 'articles' ] . first [ 'options' ] . map { |d | "#{ d [ 'text' ] } -> #{ d [ '_source' ] [ 'url' ] } " } .
66
+ response_2 . response [ 'suggest' ] [ 'articles' ] . first [ 'options' ] . map { |d | "#{ d [ 'text' ] } -> #{ d [ '_source' ] [ 'url' ] } " } .
80
67
inspect . ansi ( :bold , :blue )
81
68
82
69
require 'pry' ; binding . pry ;
You can’t perform that action at this time.
0 commit comments