# How to handle nonexistent index in Logstash Elasticsearch filter

**URL:** <https://discuss.elastic.co/t/how-to-handle-nonexistent-index-in-logstash-elasticsearch-filter/254938>\
**Category:** Logstash\
**Created:** [November 10, 2020, 3:46pm UTC](https://discuss.elastic.co/t/how-to-handle-nonexistent-index-in-logstash-elasticsearch-filter/254938 "2020-11-10T15:46:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![egray](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@egray](https://discuss.elastic.co/u/egray)\
**Post date:** [November 10, 2020, 3:46pm UTC](https://discuss.elastic.co/t/how-to-handle-nonexistent-index-in-logstash-elasticsearch-filter/254938/1 "2020-11-10T15:46:10Z")

</div>

Hi,  
I'm getting the exception `Failed to query elasticsearch for previous event` in Logstash when I use the Elasticsearch filter plugin, because `index` is dynamic and I can't guarantee that it exists. I could do this with Ruby and use exception handling, but is there a simpler way to handle it using the Elasticsearch filter?  
Thanks.

---

<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:** [December 8, 2020, 3:46pm UTC](https://discuss.elastic.co/t/how-to-handle-nonexistent-index-in-logstash-elasticsearch-filter/254938/2 "2020-12-08T15:46:17Z")

</div>

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