# How to search for specific data range when indexes are created according to date

**URL:** <https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279>\
**Category:** Elasticsearch\
**Created:** [February 16, 2017, 5:13am UTC](https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279 "2017-02-16T05:13:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Pradhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_pradhan/32/14202_2.png) [@Rahul\_Pradhan](https://discuss.elastic.co/u/Rahul_Pradhan)\
**Post date:** [February 16, 2017, 5:13am UTC](https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279/1 "2017-02-16T05:13:35Z")

</div>

Our elastic installation contains years of data. Indexes are created according to date.  
Eg. test-2015.04.03, test-2016.04.04 and so on.  
If we want to search for specific data range like from 2016.04.04 - 2016.05.04 then how to do that. If we use wild card like trade-2016.04\* then we end up searching into more indexes then we really want.  
We are on elastic search 2.3.  
I am aware of date maths support for index resolution but it always starts from now as reference date. like now +2 , now -2 etc.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 16, 2017, 6:38am UTC](https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279/2 "2017-02-16T06:38:47Z")

</div>

ES uses [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-field-stats.html#search-field-stats](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-field-stats.html#search-field-stats) to intelligently figure out what indices it needs to query, so you can just use the wildcards to simplify your queries.

---

<div class="post-metadata">

**Author:** ![Rahul\_Pradhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_pradhan/32/14202_2.png) [@Rahul\_Pradhan](https://discuss.elastic.co/u/Rahul_Pradhan)\
**Post date:** [February 16, 2017, 11:46am UTC](https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279/3 "2017-02-16T11:46:17Z")

</div>

Thanks for you response.

---

<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:** [March 16, 2017, 11:46am UTC](https://discuss.elastic.co/t/how-to-search-for-specific-data-range-when-indexes-are-created-according-to-date/75279/4 "2017-03-16T11:46:30Z")

</div>

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