1

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"
    }
}
Summer-Sky
  • 463
  • 8
  • 21
  • Could you post the index mapping too? – madsen Nov 21 '15 at 19:02
  • @madsen the specific structure of the mapping should be irrelevant ... it has a string field named name ... however i added the mapping – Summer-Sky Nov 21 '15 at 19:19
  • It's not necessarily irrelevant if the field is analyzed, filtered and/or tokenized. – madsen Nov 21 '15 at 19:31
  • 1
    I currently have the same problem. Here is the the relevant [issue](https://github.com/elastic/elasticsearch/issues/11579) and [pull request](https://github.com/elastic/elasticsearch/pull/15410). Currently open but seems ready for merge. – worldsayshi Oct 13 '16 at 10:03

2 Answers2

1

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.

ChintanShah25
  • 12,366
  • 3
  • 43
  • 44
1

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.

madsen
  • 422
  • 3
  • 9