# How to get prefix search working without re-indexing of existing data

**URL:** <https://discuss.elastic.co/t/how-to-get-prefix-search-working-without-re-indexing-of-existing-data/163066>\
**Category:** Elasticsearch\
**Created:** [January 6, 2019, 8:49am UTC](https://discuss.elastic.co/t/how-to-get-prefix-search-working-without-re-indexing-of-existing-data/163066 "2019-01-06T08:49:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitmbm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amitmbm/32/102111_2.png) [@amitmbm](https://discuss.elastic.co/u/amitmbm)\
**Post date:** [January 6, 2019, 8:49am UTC](https://discuss.elastic.co/t/how-to-get-prefix-search-working-without-re-indexing-of-existing-data/163066/1 "2019-01-06T08:49:45Z")

</div>

Earlier I implemented a search as you type using the prefix query but then it has got a lot of issues due to stemmed fields in my index :-

Suppose my index name is `jaipur` and it contains a field `title` which is analyzed based on the language analyzer.

So if the index is for `english` language, then below stemmed words would be stored like below

```auto
original word stemmed form
nutritional nutrit
suggestions suggest
recommendation recommend

```

Now using prefix query, when I search till `nutrit` or `suggest` it gives me the result but as soon as type a next character after the stemmed form  
like `nutriti` or `suggestio` my results go away as these tokens are not present in my inverted index and prefix queries are not analyzed.

I read a lot of elasticsearch documentation and it seems only [index time solution](https://www.elastic.co/guide/en/elasticsearch/guide/current/_index_time_search_as_you_type.html) would solve my issue but the downside of it is that it requires re-indexing the whole data and I have more than billion documents in my index, we **wanted to avoid re-indexing that was also one of the reason, we earlier choosed prefix based solution**.

**Could anybody suggest is there any alternatives?** Let me know if more information required.

**Note :- I am using ES 1.7.4 version.**

---

<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:** [February 3, 2019, 8:49am UTC](https://discuss.elastic.co/t/how-to-get-prefix-search-working-without-re-indexing-of-existing-data/163066/2 "2019-02-03T08:49:49Z")

</div>

Closed on February 3, 2019, 8:49am UTC

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