Completion Suggester incorrect sorting by weight

Hi there,

I have been used to completion type suggester which implementet nest in . Net. So I added 60M datas in elasticclient. So Completin suggester field model like this .net :

public Dictionary<string, List<Completion.Field> Suggest

So my model data like this:
"suggest": {
"tr-TR": [
{
"input": [
"Tunik Kadın"
],
"weight": 100
},
{
"input": [
"Kadın Tunik"
],
"weight": 101
},
{
"input": [
"Tunik Kadın Gri"
],
"weight": 75
},
{
"input": [
"Tunik Gri Kadın"
],
"weight": 76
},
{
"input": [
"Gri Tunik Kadın"
],
"weight": 77
}
],
"en-US": [
{
"input": [
"Tunik Women"
],
"weight": 100
},
{
"input": [
"Women Tunik"
],
"weight": 101
},
{
"input": [
"Tunik Women Green"
],
"weight": 75
},
{
"input": [
"Tunik Green Kadın"
],
"weight": 76
},
{
"input": [
"Green Tunik Kadın"
],
"weight": 77
}
]
}

So Each suggest array has language that inside suggest word which contains their own specifc weight.
But, completion suggest does not get data order by mine suggest weight.

So my Query like this:

GET sefiktest_index_1/_search
{
"_source": "suggest.tr-TR",
"size": 0,
"suggest": {
"testSuggest": {
"prefix": "Tunik",
"completion": {
"skip_duplicates": true,
"field": "suggest.tr-TR.input.suggest",
"size": 4,
"fuzzy": {
"fuzziness":0
}
}
}
}
}

I expected to get data order : Tunik Kadın : Weight 100, Tunik Kadın Gri: weight : 75,
but it gets top on the list less than weigh all documents.

What are the problems. How to run weight correctly inside completion suggest?

Thank you best regards.

The completion suggester is document based. This means that it will return the document with the best matching suggestions. In your example since you only have one document it will return the _source of this document but if you separate your suggestions in different document you'll see the correct order in the response.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.