HTTP 404: Index Not Found

This message indicates that you're trying to access an index that is not registered with Elasticsearch.
Last updated
July 7, 2023

This response is distinct from the "Cluster not found" message. This message indicates that you're trying to access an index that is not registered with Elasticsearch. For example:

<div class="code-snippet-container">
<a fs-copyclip-element="click-2" href="#" class="btn w-button code-copy-button" title="Copy">
<img class="copy-image" src="" loading="lazy" alt="">
<img class="copied-image" src="" loading="lazy" alt="">
<div class="code-snippet">
<pre><code fs-codehighlight-element="code" fs-copyclip-element="copy-this-2" class="hljs language-javascript">GET /nonexistent_index/_search?pretty
 "error" : {
   "root_cause" : [ {
     "type" : "index_not_found_exception",
     "reason" : "no such index",
     "resource.type" : "index_or_alias",
     "" : "nonexistent_index",
     "index" : "nonexistent_index"
   } ],
   "type" : "index_not_found_exception",
   "reason" : "no such index",
   "resource.type" : "index_or_alias",
   "" : "nonexistent_index",
   "index" : "nonexistent_index"
 "status" : 404

There are a couple reasons you might see this:

  • Race condition. You or your app may be trying to access an index before it was created.
  • Typo. You may have misspelled or only partially copy/pasted the name of the index you're trying to access.
  • The index has been deleted. Trying to access an index that has been deleted will return an HTTP 404 from Elasticsearch.

Important Note on Index Auto-Creation

By default, Elasticsearch has a feature that will automatically create indices. Simply pushing data into a non-existing index will cause that index to be created with mappings inferred from the data. In accordance with Elasticsearch best practices for production applications, we've disabled this feature on Bonsai.

However, some popular tools such as Kibana and Logstash do not support explicit index creation, and rely on auto-creation being available. To accommodate these tools, we've whitelisted popular time-series index names such as <span class="inline-code"><pre><code>logstash*</code></pre></span>, <span class="inline-code"><pre><code>requests*</code></pre></span>, <span class="inline-code"><pre><code>events*</code></pre></span>, <span class="inline-code"><pre><code>kibana*</code></pre></span>. and <span class="inline-code"><pre><code>kibana-int*</code></pre></span>.

The solution to this error message is to confirm that the index name is correct. If so, make sure it is properly created (with all the mappings it needs), and try again.

View code snippet
Close code snippet