# Autocompletion by most popular phrases in the text

**URL:** <https://discuss.elastic.co/t/autocompletion-by-most-popular-phrases-in-the-text/329012>\
**Category:** Elasticsearch\
**Created:** [March 31, 2023, 6:52am UTC](https://discuss.elastic.co/t/autocompletion-by-most-popular-phrases-in-the-text/329012 "2023-03-31T06:52:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quaerere](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quaerere/32/118026_2.png) [@Quaerere](https://discuss.elastic.co/u/Quaerere)\
**Post date:** [March 31, 2023, 6:52am UTC](https://discuss.elastic.co/t/autocompletion-by-most-popular-phrases-in-the-text/329012/1 "2023-03-31T06:52:59Z")

</div>

Let's say I have many text fields indexed:

```auto
{
  "body": "The quick brown fox jumps over the lazy dog"
}

{
  "body": "There was a quick brown fox in a forest"
}

{
  "body": "Forest was a most fun place for a lazy dog to play."
}

{
  "body": "He wants a lazy dog to play."
}
...

```

I would like to implement a search phrase suggestion by the phrases in the text that are indexed. Let's say if an user types `qui` the suggestions show `quick`. If user types `quick` it would suggest `quick brown`, `quick brown fox` etc.

OOTB `autocomplete` feature seems to give me whole body field, not just phrase. `search_as_you_type` does the same. `Term suggesters` suggests just one word, `phrase suggesters` just tries to fix typos. Nothing that I have tried seemed to give me the result I need.

Is there a way to do this, at first glance, simple task?

---

<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 28, 2023, 6:53am UTC](https://discuss.elastic.co/t/autocompletion-by-most-popular-phrases-in-the-text/329012/2 "2023-04-28T06:53:18Z")

</div>

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