# Wildcard index name with date range filter

**URL:** <https://discuss.elastic.co/t/wildcard-index-name-with-date-range-filter/79199>\
**Category:** Elasticsearch\
**Created:** [March 20, 2017, 5:33am UTC](https://discuss.elastic.co/t/wildcard-index-name-with-date-range-filter/79199 "2017-03-20T05:33:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [March 20, 2017, 5:33am UTC](https://discuss.elastic.co/t/wildcard-index-name-with-date-range-filter/79199/1 "2017-03-20T05:33:11Z")

</div>

Hi,

I'm having trouble figuring out whether I can safely use wildcard index names when I have a date range filter, ie whether ES will do magic to query only those indices that should be required by a given date range. For example using daily indices, and querying a 15m window with a filter like this:

```
"filter": { "bool": { "must": [ { "range" : {
  "@timestamp": { "gte": 1489986129286, "lte": 1489987029286, "format": "epoch_millis" }
} } ] } }

```

Can I use a wildcard in the index name like `/indexname-*` and expect only the relevant index to be hit?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 20, 2017, 5:58am UTC](https://discuss.elastic.co/t/wildcard-index-name-with-date-range-filter/79199/2 "2017-03-20T05:58:53Z")

</div>

In 5.x series there is now some magic behind the scene. This is what we called instant aggregations in Kibana.

But you need to set size to 0. Read [https://www.elastic.co/blog/instant-aggregations-rewriting-queries-for-fun-and-profit](https://www.elastic.co/blog/instant-aggregations-rewriting-queries-for-fun-and-profit)

---

<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 17, 2017, 5:59am UTC](https://discuss.elastic.co/t/wildcard-index-name-with-date-range-filter/79199/3 "2017-04-17T05:59:23Z")

</div>

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