Elasticsearch suggest by middle words by making preserve_position_increments: false


(shamsul haque) #1

Hi,

I am trying to implement middle word search, as Completion Suggester dochttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html said,
preserve_position_increments: if disabled and using stopword analyzer, you
could get a string starting with 'the beatles', if you suggest for 'b'.

i am trying to implement same by providing below mapping:

curl -XPUT 'http://localhost:9200/sugg_test/test/_mapping' -d '{ "test" : {
"properties" : { "name" : { "type" : "string" }, "auto_suggest" : { "type"
: "completion", "index_analyzer" : "simple", "search_analyzer" : "stop",
"preserve_position_increments" : false, "payloads" : true } } } }'

but it dosen't work. Please any body help me, where i am doing wrong.
i know i can do the same by splitting the word and add them in input, but i
want to implement it by mapping.

Thanks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/632d683f-4950-4f16-81c5-eaeeb6039879%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Clinton Gormley) #2

you're using the "simple" analyzer at index time, which means that it is
indexing ["the","beatles"]. If you change it to use the "stop" analyzer at
both search and index time then it should work.

clint

On 4 March 2014 15:38, Shams Haque shams.hq@gmail.com wrote:

Hi,

I am trying to implement middle word search, as Completion Suggester dochttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html said,
preserve_position_increments: if disabled and using stopword analyzer, you
could get a string starting with 'the beatles', if you suggest for 'b'.

i am trying to implement same by providing below mapping:

curl -XPUT 'http://localhost:9200/sugg_test/test/_mapping' -d '{ "test" :
{ "properties" : { "name" : { "type" : "string" }, "auto_suggest" : {
"type" : "completion", "index_analyzer" : "simple", "search_analyzer" :
"stop", "preserve_position_increments" : false, "payloads" : true } } } }'

but it dosen't work. Please any body help me, where i am doing wrong.
i know i can do the same by splitting the word and add them in input, but
i want to implement it by mapping.

Thanks

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/632d683f-4950-4f16-81c5-eaeeb6039879%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/632d683f-4950-4f16-81c5-eaeeb6039879%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPt3XKQqhAFoRUUaZYEDM_L8hRtnCFk6pGWA2nFHHUtk2bJR1w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3