I am using Elasticsearch 5.5.2. I have the below mapping and the documents
Mapping --
PUT /testindex/
{
"mappings": {
"testtype": {
"properties": {
"city": {
"type": "text"
}
}
}
}
}
Documents --
First one --
"_source": {
"city": "a"
}
Second one --
"_source": {
"city": "ab"
}
And Third one --
"_source": {
"city": "abc"
}
When I try the below, I am NOT getting any suggestions
POST /testindex/testtype/_search
{
"suggest": {
"my_suggest": {
"text": "a",
"term": {
"field": "city",
"min_word_length": 1
}
}
}
}
As per my understanding of the documentation of the term suggester, I am expecting 'ab' as the suggested term for the above query. But I am getting zero suggestions as the result for the above query. Can someone please clarify where I am wrong?
In the below query, for the suggest text 'ab', I am getting 'abc' as the suggested term
The query with 'ab' as the suggest term is
POST /testindex/testtype/_search
{
"suggest": {
"my_suggest": {
"text": "ab",
"term": {
"field": "city",
"min_word_length": 1
}
}
}
}
The result I am getting is
"options": [
{
"text": "abc",
"score": 0.5,
"freq": 1
}
]
When I am getting 'abc' as the suggested term for the suggest text 'ab', why I am NOT getting 'ab' as the suggested term for the suggest text 'a', though I have set the property 'min_word_length' to 1.
Please clarify.
Thank you very much.