With the Elasticsearch completion assistant, I am having trouble returning multiple word suggestions matching a single word query.
Structure example:
PUT /test_index/ { "mappings": { "item": { "properties": { "test_suggest": { "type": "completion", "index_analyzer": "whitespace", "search_analyzer": "whitespace", "payloads": false } } } } } PUT /test_index/item/1 { "test_suggest": { "input": [ "cat dog", "elephant" ] } }
Work request:
POST /test_index/_suggest { "test_suggest":{ "text":"cat", "completion": { "field" : "test_suggest" } } }
with the result
{ "_shards": { "total": 5, "successful": 5, "failed": 0 }, "test_suggest": [ { "text": "cat", "offset": 0, "length": 3, "options": [ { "text": "cat dog", "score": 1 } ] } ] }
The request failed:
POST /test_index/_suggest { "test_suggest":{ "text":"dog", "completion": { "field" : "test_suggest" } } }
with the result
{ "_shards": { "total": 5, "successful": 5, "failed": 0 }, "test_suggest": [ { "text": "dog", "offset": 0, "length": 3, "options": [] } ] }
I would expect the same result as a working request matching "cat dog". Any suggestions, what is the problem, and how to make a failed request work? I get the same results when using a standard parser instead of a space parser. I would like to use a few words per input line, as shown in the example above.
elasticsearch autosuggest search-suggestion
Neman
source share