I want to implement autocomplete feature in ES I have followed this tutorial from ES documentations
my Indexing is:
{
"properties" : {
"suggest" : {
"type" : "completion"
},
"titleKeyword" : {
"type": "keyword"
}
}
}
}
I am putting text value in titleKeyword
field
then I queried like follows
{
"suggest" : {
"my-suggestion" : {
"text" : "iphone",
"term" : {
"field" : "titleKeyword"
}
}
}
}
The result is:
...
"suggest": {
"my-suggestion": [
{
"text": "iphone",
"offset": 0,
"length": 6,
"options": []
}
]
}
expected result is
options:[iphone x, iphone 11, iphone 11 pro, iphone 7]
Note: titles are complete sentences like "iPhone x 64gb black"
as far as I understood from the documentation that I have to give the suggestions in "advance" when creating the document which is impossible in my case is there any way to implement this feature without putting suggestions manually?
Thanks