# How to dynamically search from mutiple offset inside an index in elastic search?

**URL:** <https://discuss.elastic.co/t/how-to-dynamically-search-from-mutiple-offset-inside-an-index-in-elastic-search/164778>\
**Category:** Elasticsearch\
**Created:** [January 18, 2019, 11:09am UTC](https://discuss.elastic.co/t/how-to-dynamically-search-from-mutiple-offset-inside-an-index-in-elastic-search/164778 "2019-01-18T11:09:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash\_Kapoor](https://avatars.discourse-cdn.com/v4/letter/y/5f9b8f/32.png) [@Yash\_Kapoor](https://discuss.elastic.co/u/Yash_Kapoor)\
**Post date:** [January 18, 2019, 11:09am UTC](https://discuss.elastic.co/t/how-to-dynamically-search-from-mutiple-offset-inside-an-index-in-elastic-search/164778/1 "2019-01-18T11:09:49Z")

</div>

Say I have a string indexed and I want to take out a substring from it at the time of search query. How will I achieve this?

For example -

String to be indexed -

"The quick brown fox"

Searches that I want to make -

```auto
- "the"
- "thequ"
- "quick"
- "th"
- "quick the"

```

How should I do this if I am working with Django and elasticsearch?

I have tried to use ngrams and have merged the whole string to create an n gram index for every combination possible. This is on the code side, How to do this with elastic search.

---

<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 15, 2019, 11:09am UTC](https://discuss.elastic.co/t/how-to-dynamically-search-from-mutiple-offset-inside-an-index-in-elastic-search/164778/2 "2019-02-15T11:09:49Z")

</div>

Closed on February 15, 2019, 11:09am UTC

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