# Grouping similar results in aggs search

**URL:** <https://discuss.elastic.co/t/grouping-similar-results-in-aggs-search/222385>\
**Category:** Elasticsearch\
**Created:** [March 5, 2020, 11:53pm UTC](https://discuss.elastic.co/t/grouping-similar-results-in-aggs-search/222385 "2020-03-05T23:53:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![puks1978](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@puks1978](https://discuss.elastic.co/u/puks1978)\
**Post date:** [March 5, 2020, 11:53pm UTC](https://discuss.elastic.co/t/grouping-similar-results-in-aggs-search/222385/1 "2020-03-05T23:53:45Z")

</div>

Hi community,

I am hoping someone can help. I have ES 7.5.2 running and indexed a whole bunch of documents. When a user performs a search I store this in another index so I can later recall the previous searches. This is also working well however when I perform a lookup of previous searches (as a user types/auto suggest) I am getting some messy information. I know why but I am wondering if there's a way to stop it.

The information I get are duplicate results but for incomplete words.

For example:  
User searched for: What is ri  
User searched for: What is risk  
User searched for: What is risky

Now if a user starts typing: "What is r" I would like only 1 result to appear which should be "What is risky" as that is the most complete query. I know ES stored all 3 queries as different requests but is it possible to show the best option only?

My aggs is:

```
"aggs": {
  "suggester": {
    "terms": {
      "field": "title_na"
    }
  }
}

```

Thoughts?

---

<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:** [April 2, 2020, 11:53pm UTC](https://discuss.elastic.co/t/grouping-similar-results-in-aggs-search/222385/2 "2020-04-02T23:53:48Z")

</div>

Closed on April 2, 2020, 11:53pm UTC

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