# Fail with IndexMissingException if index does not exist

**URL:** <https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530>\
**Category:** Elasticsearch\
**Created:** [October 6, 2011, 1:19pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530 "2011-10-06T13:19:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steff](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Steff](https://discuss.elastic.co/u/Steff)\
**Post date:** [October 6, 2011, 1:19pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/1 "2011-10-06T13:19:42Z")

</div>

Hi

I have noticed that the index just automatically gets created if you  
try to index a new document into an index that does not already exist.

Can I somehow change that behaviour, so that I get a  
IndexMissingException instead, in such cases?

Regards, Per Steffensen

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 6, 2011, 2:55pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/2 "2011-10-06T14:55:40Z")

</div>

Yes, set action.auto\_create\_index setting to false.

On Thu, Oct 6, 2011 at 3:19 PM, Steff [steff@designware.dk](mailto:steff@designware.dk) wrote:

> Hi
> 
> I have noticed that the index just automatically gets created if you  
> try to index a new document into an index that does not already exist.
> 
> Can I somehow change that behaviour, so that I get a  
> IndexMissingException instead, in such cases?
> 
> Regards, Per Steffensen

---

<div class="post-metadata">

**Author:** ![Steff](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Steff](https://discuss.elastic.co/u/Steff)\
**Post date:** [October 11, 2011, 12:08pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/3 "2011-10-11T12:08:50Z")

</div>

On 6 Okt., 16:55, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Yes, set action.auto\_create\_index setting to false.

Thanks. It seems to do the job.

Just a clarifying question.  
Does this setting need to be on the (client-)node where you call  
node.client().admin().indices().create(createIndexRequest).actionGet()?  
Or in the settings of createIndexRequest? Or in the elastissearch.yml  
of the (non-client-)nodes actually managing indexes and shards? Or all  
places or...?  
Just a short comment about where this "setting" is used and where it  
is not used, would be great. Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 12, 2011, 8:59pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/4 "2011-10-12T20:59:13Z")

</div>

It should be set on all "master eligible nodes". Client nodes (nodes started  
with node.client set to true, or using NodeBuilder.cleint(true) ) will not  
become master nodes. The setting is basically checked checked on the  
currently elected master node.

On Tue, Oct 11, 2011 at 2:08 PM, Steff [steff@designware.dk](mailto:steff@designware.dk) wrote:

> On 6 Okt., 16:55, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Yes, set action.auto\_create\_index setting to false.
> 
> Thanks. It seems to do the job.
> 
> Just a clarifying question.  
> Does this setting need to be on the (client-)node where you call  
> node.client().admin().indices().create(createIndexRequest).actionGet()?  
> Or in the settings of createIndexRequest? Or in the elastissearch.yml  
> of the (non-client-)nodes actually managing indexes and shards? Or all  
> places or...?  
> Just a short comment about where this "setting" is used and where it  
> is not used, would be great. Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 12, 2011, 9:01pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/5 "2011-10-12T21:01:09Z")

</div>

Sorry, was thinking about another setting in another thread, and answered  
this one... . The setting should be set on all nodes, including the client  
nodes. Its basically checked on the node that actually "starts" the index  
operation, checking if the index exists, and if not, creates the index.

On Wed, Oct 12, 2011 at 10:59 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> It should be set on all "master eligible nodes". Client nodes (nodes  
> started with node.client set to true, or using NodeBuilder.cleint(true) )  
> will not become master nodes. The setting is basically checked checked on  
> the currently elected master node.
> 
> On Tue, Oct 11, 2011 at 2:08 PM, Steff [steff@designware.dk](mailto:steff@designware.dk) wrote:
> 
> > On 6 Okt., 16:55, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Yes, set action.auto\_create\_index setting to false.
> > 
> > Thanks. It seems to do the job.
> > 
> > Just a clarifying question.  
> > Does this setting need to be on the (client-)node where you call  
> > node.client().admin().indices().create(createIndexRequest).actionGet()?  
> > Or in the settings of createIndexRequest? Or in the elastissearch.yml  
> > of the (non-client-)nodes actually managing indexes and shards? Or all  
> > places or...?  
> > Just a short comment about where this "setting" is used and where it  
> > is not used, would be great. Thanks

---

<div class="post-metadata">

**Author:** ![Steff](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Steff](https://discuss.elastic.co/u/Steff)\
**Post date:** [October 18, 2011, 2:43pm UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/6 "2011-10-18T14:43:14Z")

</div>

On 12 Okt., 23:01, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Sorry, was thinking about another setting in another thread, and answered  
> this one... . The setting should be set on all nodes, including the client  
> nodes. Its basically checked on the node that actually "starts" the index  
> operation, checking if the index exists, and if not, creates the index.

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:** [July 6, 2017, 3:51am UTC](https://discuss.elastic.co/t/fail-with-indexmissingexception-if-index-does-not-exist/5530/7 "2017-07-06T03:51:38Z")

</div>


