# Failed to query elasticsearch for previous event - no such index

**URL:** <https://discuss.elastic.co/t/failed-to-query-elasticsearch-for-previous-event-no-such-index/216185>\
**Category:** Logstash\
**Created:** [January 23, 2020, 6:36am UTC](https://discuss.elastic.co/t/failed-to-query-elasticsearch-for-previous-event-no-such-index/216185 "2020-01-23T06:36:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mullan](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@mullan](https://discuss.elastic.co/u/mullan)\
**Post date:** [January 23, 2020, 6:36am UTC](https://discuss.elastic.co/t/failed-to-query-elasticsearch-for-previous-event-no-such-index/216185/1 "2020-01-23T06:36:40Z")

</div>

Hi ,  
My conf file look like this .  
input {  
jdbc {  
.....  
statement =\> "Select userId as id,`UserID` as userid,firstName as firstname, lastName as lastname,`countryCode` as countrycode,`countryName` as countryname,`bid` as bid, isUser as isuser From Internal "  
}

filter{  
elasticsearch {  
hosts =\> ["localhost:9200"]  
enable\_sort =\> false  
index =\> "country"  
query =\> "countryname:%{[countryname]} AND countryid:%{[countrycode]}"  
fields =\> [["regionid", "regionid"]]  
}  
}

I have been getting the following error

Failed to query elasticsearch for previous event {:index=\>"country", :error=\>"[404] {"error":{"root\_cause":[{"type":"index\_not\_found\_exception","reason":"no such index [country]","resource.type":"index\_or\_alias"

Any help would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![grumo35](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grumo35/32/59451_2.png) [@grumo35](https://discuss.elastic.co/u/grumo35)\
**Post date:** [January 23, 2020, 8:21am UTC](https://discuss.elastic.co/t/failed-to-query-elasticsearch-for-previous-event-no-such-index/216185/2 "2020-01-23T08:21:03Z")

</div>

So it looks like the index you're querying "country" is not existing

Can you ensure the "country" index is created in elasticsearch ?

---

<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 20, 2020, 8:21am UTC](https://discuss.elastic.co/t/failed-to-query-elasticsearch-for-previous-event-no-such-index/216185/3 "2020-02-20T08:21:04Z")

</div>

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