File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
elasticsearch-model/examples Expand file tree Collapse file tree 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={})
5050puts "Article search:" . ansi ( :bold ) ,
5151 response_1 . to_a . map { |d | "Title: #{ d . title } " } . inspect . ansi ( :bold , :yellow )
5252
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 \
6754 query : {
6855 match : { title : 'foo' }
6956 } ,
@@ -76,7 +63,7 @@ def as_indexed_json(options={})
7663 _source : [ 'title' , 'url' ]
7764
7865puts "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' ] } " } .
8067 inspect . ansi ( :bold , :blue )
8168
8269require 'pry' ; binding . pry ;
You can’t perform that action at this time.
0 commit comments