Order of result in complain autho-suggest

Hi, I have a problem with the order of result in compain autho-suggest.

I created index with mapping:

{ "properties": { "suggest": { "type": "completion", "analyzer": "pattern", "preserve_separators": true, "preserve_position_increments": true, "max_input_length": 50 } } }

After that I added few docs:

{
"suggest": "Custom Color, Green, #0f0"
}
{
"suggest": "Custom Color Test, Red, #f00"
}
{
"suggest": "Custom Color NewTest, Blue, #00f"
}

I tried to make a searching query like this:

{
"suggest": {
"color_suggest": {
"prefix": "Custom Color",
"completion": {
"field": "suggest",
"skip_duplicates": true
}
}
}
}

And I have the next result:

  • Custom Color NewTest, Blue, #00f
  • Custom Color Test, Red, #f00
  • Custom Color, Green, #0f0

But I need more short version first (Custom Color, Green, #0f0)
How can I get the correct result?

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