Suggesters
The suggest feature suggests similar looking terms based on a provided text by using a suggester. Suggest requests executed against the _suggest endpoint should omit the surrounding suggest element which is only used if the suggest request is part of a search.
curl -XPOST 'localhost:9200/_suggest' -d '{
"my-suggestion" : {
"text" : "the amsterdma meetpu",
"term" : {
"field" : "body"
}
}
}'
Each options array contains an option object that includes the suggested text, its document frequency and score compared to the suggest entry text. The meaning of the score depends on the used suggester. The term suggester’s score is based on the edit distance.
"options": [
{
"text": "amsterdam",
"freq": 77,
"score": 0.8888889
},
...
]
Global suggest text
To avoid repetition of the suggest text, it is possible to define a global text.
"suggest" : {
"text" : "the amsterdma meetpu",
"my-suggest-1" : {
"term" : {
"field" : "title"
}
},
"my-suggest-2" : {
"term" : {
"field" : "body"
}
}
}