# ES get IndexMissingException when search not existed index

**URL:** <https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369>\
**Category:** Elasticsearch\
**Created:** [August 28, 2013, 2:37pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369 "2013-08-28T14:37:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lijionly](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lijionly](https://discuss.elastic.co/u/lijionly)\
**Post date:** [August 28, 2013, 2:37pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/1 "2013-08-28T14:37:03Z")

</div>

Hi,  
We are building search system like this:

1. backend, use elasticsearch as search engine. Every day create a new  
index by using the date as index name, such as 20130801,20130802...
2. frontend use web page, pepole can select the date range in calendar and  
search for the matched records.  
Here is a problem, frontend user don't know when ES start to index. He may  
just choose a date range from the web, such as 20130720 to 20130802.  
In backend, we will compose the REST request to search in all selected  
index: [http://locahost:9200/20130720,20130721...20130802/](http://locahost:9200/20130720,20130721...20130802/)...  
But ES just has index since 20130801, which means that the index  
20130720,20130721...don't exist. And this operation will get  
IndexMissingException result.

Is there a way to ignore IndexMissingException and just return the matched  
records in existed index?  
Or there is some other way to do the things?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Vadim\_Kisselmann](https://avatars.discourse-cdn.com/v4/letter/v/2bfe46/32.png) [@Vadim\_Kisselmann](https://discuss.elastic.co/u/Vadim_Kisselmann)\
**Post date:** [August 28, 2013, 2:43pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/2 "2013-08-28T14:43:16Z")

</div>

Hi,  
fire [http://localhost:9200/\_aliases](http://localhost:9200/_aliases) on your server, grep the index names  
and modify the search request with given indexes.  
cheers  
Vadim

Am Mittwoch, 28. August 2013 16:37:03 UTC+2 schrieb [liji...@gmail.com](mailto:liji...@gmail.com):

> Hi,  
> We are building search system like this:
> 
> 1. backend, use elasticsearch as search engine. Every day create a new  
> index by using the date as index name, such as 20130801,20130802...
> 2. frontend use web page, pepole can select the date range in calendar and  
> search for the matched records.  
> Here is a problem, frontend user don't know when ES start to index. He may  
> just choose a date range from the web, such as 20130720 to 20130802.  
> In backend, we will compose the REST request to search in all selected  
> index: [http://locahost:9200/20130720,20130721...20130802/](http://locahost:9200/20130720,20130721...20130802/)...  
> But ES just has index since 20130801, which means that the index  
> 20130720,20130721...don't exist. And this operation will get  
> IndexMissingException result.
> 
> Is there a way to ignore IndexMissingException and just return the matched  
> records in existed index?  
> Or there is some other way to do the things?
> 
> Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![lijionly](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lijionly](https://discuss.elastic.co/u/lijionly)\
**Post date:** [August 28, 2013, 3:07pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/3 "2013-08-28T15:07:16Z")

</div>

[http://localhost:9200/\_aliases](http://localhost:9200/_aliases) is to get all aliases, is there a way to get  
the earilest index name? or can it be ordered by name?  
Since I need to grep range date one by one in aliases

在 2013年8月28日星期三UTC+8下午10时43分16秒，Vadim Kisselmann写道：

> Hi,  
> fire [http://localhost:9200/\_aliases](http://localhost:9200/_aliases) on your server, grep the index names  
> and modify the search request with given indexes.  
> cheers  
> Vadim
> 
> Am Mittwoch, 28. August 2013 16:37:03 UTC+2 schrieb [liji...@gmail.com](mailto:liji...@gmail.com):
> 
> > Hi,  
> > We are building search system like this:
> > 
> > 1. backend, use elasticsearch as search engine. Every day create a new  
> > index by using the date as index name, such as 20130801,20130802...
> > 2. frontend use web page, pepole can select the date range in calendar  
> > and search for the matched records.  
> > Here is a problem, frontend user don't know when ES start to index. He  
> > may just choose a date range from the web, such as 20130720 to 20130802.  
> > In backend, we will compose the REST request to search in all selected  
> > index: [http://locahost:9200/20130720,20130721...20130802/](http://locahost:9200/20130720,20130721...20130802/)...  
> > But ES just has index since 20130801, which means that the index  
> > 20130720,20130721...don't exist. And this operation will get  
> > IndexMissingException result.
> > 
> > Is there a way to ignore IndexMissingException and just return the  
> > matched records in existed index?  
> > Or there is some other way to do the things?
> > 
> > Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [August 28, 2013, 4:12pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/4 "2013-08-28T16:12:50Z")

</div>

Your index naming convention should make the index names easily sortable.  
You can have more than one alias on an index, so you can also assign an  
alias such as "oldest" to your oldest index and search for that alias.

--  
Ivan

On Wed, Aug 28, 2013 at 8:07 AM, [lijionly@gmail.com](mailto:lijionly@gmail.com) wrote:

> [http://localhost:9200/\_aliases](http://localhost:9200/_aliases) is to get all aliases, is there a way to  
> get the earilest index name? or can it be ordered by name?  
> Since I need to grep range date one by one in aliases
> 
> 在 2013年8月28日星期三UTC+8下午10时43分16秒，Vadim Kisselmann写道：
> 
> > Hi,  
> > fire [http://localhost:9200/\_aliases](http://localhost:9200/_aliases) on your server, grep the index names  
> > and modify the search request with given indexes.  
> > cheers  
> > Vadim
> > 
> > Am Mittwoch, 28. August 2013 16:37:03 UTC+2 schrieb [liji...@gmail.com](mailto:liji...@gmail.com):
> > 
> > > Hi,  
> > > We are building search system like this:
> > > 
> > > 1. backend, use elasticsearch as search engine. Every day create a new  
> > > index by using the date as index name, such as 20130801,20130802...
> > > 2. frontend use web page, pepole can select the date range in calendar  
> > > and search for the matched records.  
> > > Here is a problem, frontend user don't know when ES start to index. He  
> > > may just choose a date range from the web, such as 20130720 to 20130802.  
> > > In backend, we will compose the REST request to search in all selected  
> > > index: [http://locahost:9200/20130720,\*\*20130721...20130802/.](http://locahost:9200/20130720,**20130721...20130802/.)[http://locahost:9200/20130720,20130721...20130802/.](http://locahost:9200/20130720,20130721...20130802/.)  
> > > ..  
> > > But ES just has index since 20130801, which means that the index  
> > > 20130720,20130721...don't exist. And this operation will get  
> > > IndexMissingException result.
> > > 
> > > Is there a way to ignore IndexMissingException and just return the  
> > > matched records in existed index?  
> > > Or there is some other way to do the things?
> > > 
> > > Thanks.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Israel\_Ekpo](https://avatars.discourse-cdn.com/v4/letter/i/49beb7/32.png) [@Israel\_Ekpo](https://discuss.elastic.co/u/Israel_Ekpo)\
**Post date:** [August 28, 2013, 4:27pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/5 "2013-08-28T16:27:02Z")

</div>

Hello,

Below is an excerpt from the documentation [1]:

Since version 0.20, all multi indices API support the _ignore\_indices_option.

Setting it to "_missing_" will cause indices that do not exists to be \*  
ignored\* from the execution.

By default, when its not set, the request will fail.

When this option is set, it just ignores any missing index and does not  
report or keep track of which ones are missing.

[1] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/)

_Author and Instructor for the Upcoming Book and Lecture Series_  
_Massive Log Data Aggregation, Processing, Searching and Visualization with  
Open Source Software_  
_[http://massivelogdata.com](http://massivelogdata.com)_

On 28 August 2013 10:37, [lijionly@gmail.com](mailto:lijionly@gmail.com) wrote:

> Hi,  
> We are building search system like this:
> 
> 1. backend, use elasticsearch as search engine. Every day create a new  
> index by using the date as index name, such as 20130801,20130802...
> 2. frontend use web page, pepole can select the date range in calendar and  
> search for the matched records.  
> Here is a problem, frontend user don't know when ES start to index. He may  
> just choose a date range from the web, such as 20130720 to 20130802.  
> In backend, we will compose the REST request to search in all selected  
> index: [http://locahost:9200/20130720,20130721...20130802/](http://locahost:9200/20130720,20130721...20130802/)...  
> But ES just has index since 20130801, which means that the index  
> 20130720,20130721...don't exist. And this operation will get  
> IndexMissingException result.
> 
> Is there a way to ignore IndexMissingException and just return the matched  
> records in existed index?  
> Or there is some other way to do the things?
> 
> Thanks.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![lijionly](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@lijionly](https://discuss.elastic.co/u/lijionly)\
**Post date:** [August 29, 2013, 3:42am UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/6 "2013-08-29T03:42:38Z")

</div>

Thank you very much, but how could I use the ignore\_indices? put it in  
\_settings? or use it in request uri?  
I tried both but still get IndexMissingException

在 2013年8月29日星期四UTC+8上午12时27分02秒，Israel Ekpo写道：

> Hello,
> 
> Below is an excerpt from the documentation [1]:
> 
> Since version 0.20, all multi indices API support the _ignore\_indices_option.
> 
> Setting it to "_missing_" will cause indices that do not exists to be \*  
> ignored\* from the execution.
> 
> By default, when its not set, the request will fail.
> 
> When this option is set, it just ignores any missing index and does not  
> report or keep track of which ones are missing.
> 
> [1] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/)
> 
> _Author and Instructor for the Upcoming Book and Lecture Series_  
> _Massive Log Data Aggregation, Processing, Searching and Visualization  
> with Open Source Software_  
> _[http://massivelogdata.com](http://massivelogdata.com)_
> 
> On 28 August 2013 10:37, \<[liji...@gmail.com](mailto:liji...@gmail.com) \<javascript:\>\> wrote:
> 
> > Hi,  
> > We are building search system like this:
> > 
> > 1. backend, use elasticsearch as search engine. Every day create a new  
> > index by using the date as index name, such as 20130801,20130802...
> > 2. frontend use web page, pepole can select the date range in calendar  
> > and search for the matched records.  
> > Here is a problem, frontend user don't know when ES start to index. He  
> > may just choose a date range from the web, such as 20130720 to 20130802.  
> > In backend, we will compose the REST request to search in all selected  
> > index: [http://locahost:9200/20130720,20130721...20130802/](http://locahost:9200/20130720,20130721...20130802/)...  
> > But ES just has index since 20130801, which means that the index  
> > 20130720,20130721...don't exist. And this operation will get  
> > IndexMissingException result.
> > 
> > Is there a way to ignore IndexMissingException and just return the  
> > matched records in existed index?  
> > Or there is some other way to do the things?
> > 
> > Thanks.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [August 29, 2013, 7:53pm UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/7 "2013-08-29T19:53:04Z")

</div>

Never knew about that option was introduced since I do not use multiple  
indices. Very simple.

According to the code, you set a url param of ignore\_indices=missing  
Or via Java:  
searchRequest.ignoreIndices(IgnoreIndices.MISSING);

--  
Ivan

On Wed, Aug 28, 2013 at 8:42 PM, [lijionly@gmail.com](mailto:lijionly@gmail.com) wrote:

> Thank you very much, but how could I use the ignore\_indices? put it in  
> \_settings? or use it in request uri?  
> I tried both but still get IndexMissingException
> 
> 在 2013年8月29日星期四UTC+8上午12时27分02秒，Israel Ekpo写道：
> 
> > Hello,
> > 
> > Below is an excerpt from the documentation [1]:
> > 
> > Since version 0.20, all multi indices API support the _ignore\_indices_option.
> > 
> > Setting it to "_missing_" will cause indices that do not exists to be \*  
> > ignored\* from the execution.
> > 
> > By default, when its not set, the request will fail.
> > 
> > When this option is set, it just ignores any missing index and does not  
> > report or keep track of which ones are missing.
> > 
> > [1] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/**guide/reference/api/)[http://www.elasticsearch.org/guide/reference/api/](http://www.elasticsearch.org/guide/reference/api/)
> > 
> > _Author and Instructor for the Upcoming Book and Lecture Series_  
> > _Massive Log Data Aggregation, Processing, Searching and Visualization  
> > with Open Source Software_  
> > _[http://massivelogdata.com](http://massivelogdata.com)_
> > 
> > On 28 August 2013 10:37, [liji...@gmail.com](mailto:liji...@gmail.com) wrote:
> > 
> > > Hi,  
> > > We are building search system like this:
> > > 
> > > 1. backend, use elasticsearch as search engine. Every day create a new  
> > > index by using the date as index name, such as 20130801,20130802...
> > > 2. frontend use web page, pepole can select the date range in calendar  
> > > and search for the matched records.  
> > > Here is a problem, frontend user don't know when ES start to index. He  
> > > may just choose a date range from the web, such as 20130720 to 20130802.  
> > > In backend, we will compose the REST request to search in all selected  
> > > index: [http://locahost:9200/20130720,\*\*20130721...20130802/.](http://locahost:9200/20130720,**20130721...20130802/.)[http://locahost:9200/20130720,20130721...20130802/.](http://locahost:9200/20130720,20130721...20130802/.)  
> > > ..  
> > > But ES just has index since 20130801, which means that the index  
> > > 20130720,20130721...don't exist. And this operation will get  
> > > IndexMissingException result.
> > > 
> > > Is there a way to ignore IndexMissingException and just return the  
> > > matched records in existed index?  
> > > Or there is some other way to do the things?
> > > 
> > > Thanks.
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:18am UTC](https://discuss.elastic.co/t/es-get-indexmissingexception-when-search-not-existed-index/13369/8 "2017-07-06T02:18:55Z")

</div>


