# Elasticsearch filter - Search previous days index

**URL:** https://discuss.elastic.co/t/elasticsearch-filter-search-previous-days-index/223140
**Category:** Logstash
**Created:** [March 11, 2020, 1:12pm UTC](https://discuss.elastic.co/t/elasticsearch-filter-search-previous-days-index/223140 "2020-03-11T13:12:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KevSex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevsex/32/29031_2.png) [@KevSex](https://discuss.elastic.co/u/KevSex)
#### Post date: [March 11, 2020, 1:12pm UTC](https://discuss.elastic.co/t/elasticsearch-filter-search-previous-days-index/223140/1 "2020-03-11T13:12:19Z")

</div>

Currently I use the elasticsearch filter to search for specific events that have occurred.

The index I am searching is `index => "filebeat-*-%{+y}.%{+MM}.%{+dd}"`

I'm looking to query both today's index and also yesterday's as events may overlap by a day.

Looking at the documentation [here](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html#plugins-filters-elasticsearch-index), it allows a comma-delimited list of index names to search however I am unable to work out the correct syntax to check for yesterday's date.

Originally I thought about using a similar method that appears to work in Watcher alerts as below to search both today and yesterday's indices however this doesn't appear to work in the elasticsearch filter.

`index => "filebeat-*-{now-1d}, filebeat-*-{now}"`

Any ideas on how to achieve this?

Cheers

---

<div class="post-metadata">

### Author: ![KevSex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevsex/32/29031_2.png) [@KevSex](https://discuss.elastic.co/u/KevSex)
#### Post date: [March 11, 2020, 2:46pm UTC](https://discuss.elastic.co/t/elasticsearch-filter-search-previous-days-index/223140/2 "2020-03-11T14:46:07Z")

</div>

Got this working with the following:

`index => "<filebeat-*-{now}>,<filebeat-*-{now-1d}>"`

---

<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 8, 2020, 2:46pm UTC](https://discuss.elastic.co/t/elasticsearch-filter-search-previous-days-index/223140/3 "2020-04-08T14:46:09Z")

</div>

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