# Order of result in complain autho-suggest

**URL:** <https://discuss.elastic.co/t/order-of-result-in-complain-autho-suggest/207694>\
**Category:** Elasticsearch\
**Created:** [November 13, 2019, 11:48am UTC](https://discuss.elastic.co/t/order-of-result-in-complain-autho-suggest/207694 "2019-11-13T11:48:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![v81](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/v81/32/54177_2.png) [@v81](https://discuss.elastic.co/u/v81)\
**Post date:** [November 13, 2019, 11:48am UTC](https://discuss.elastic.co/t/order-of-result-in-complain-autho-suggest/207694/1 "2019-11-13T11:48:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 11, 2019, 11:48am UTC](https://discuss.elastic.co/t/order-of-result-in-complain-autho-suggest/207694/2 "2019-12-11T11:48:44Z")

</div>

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