Summer-Sky
Summer-Sky

Reputation: 491

Elasticsearch term suggester does not return results on exact match

when i request the suggester with

{
    "my-title-suggestions-1": {
       "text": "tücher                ",
       "term": {
            "field": "name",
       }
    },
    "my-title-suggestions-2": {
       "text": "tüchers                ",
       "term": {
           "field": "name"
       }
    }
}

it returns

{
    "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
    },
    "my-title-suggestions-1": [
    {
        "text": "tücher",
        "offset": 0,
        "length": 6,
        "options": []
    }
    ],
    "my-title-suggestions-2": [
    {
        "text": "tüchers",
        "offset": 0,
        "length": 7,
        "options": [
            {
                "text": "tücher",
                "score": 0.8333333,
                "freq": 6
            }
        ]
    }
    ]
}

i wonder why it does not return the exact match with the first suggester? the second suggester obviously has that result.

can i add other options which will resolve this behavior?

edit: the minimal mapping is just this ...

{
"name" : {
        "analyzer" : "standard",
        "type" : "string"
    }
}

Upvotes: 2

Views: 2454

Answers (2)

madsen
madsen

Reputation: 462

To add to what @ChintanShah25 said: According to https://www.elastic.co/guide/en/elasticsearch/reference/2.0/search-suggesters-term.html (see suggest_mode) the Term suggester will by default:

Only provide suggestions for suggest text terms that are not in the index.

Upvotes: 1

ChintanShah25
ChintanShah25

Reputation: 12672

I dont think you can do that and I am not sure why do you want exact match in suggestions, after all they are "suggestions".

Normally they are used to check misspelling. It will give you candidate suggestions that are similar and fall in edit distance of 2 for the word you entered.

Upvotes: 1

Related Questions