# Disable automatic index creation per-request?

**URL:** <https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419>\
**Category:** Elasticsearch\
**Created:** [October 19, 2012, 7:07am UTC](https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419 "2012-10-19T07:07:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [October 19, 2012, 7:07am UTC](https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419/1 "2012-10-19T07:07:20Z")

</div>

As far as I can see from the docs and the Java API, automatic index  
creation can only be disabled globally (per node). For my use case, it  
would be extremely useful to specify this either for certain kinds of  
indexes (via index template?) or even on a request basis (i.e. with each  
indexing request).

Background: we're using an alias to point to one "active" index out of  
several. If none of the indexes have the "active" alias, we don't want an  
index of that name to be created accidentally when trying to add documents.  
We could simply check for alias existence before indexing, but that  
obviously invites a race condition.

OTOH, we could disable automatic index creation, but we really need that  
for another kind of index. Running several separate ES instances would be a  
waste.

Is there any existing API call I've missed to solve this problem?

Thanks

Klaus

--

---

<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 21, 2012, 12:25am UTC](https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419/2 "2012-10-21T00:25:55Z")

</div>

I think this request makes a lot of sense. Thought a bit about how to expose it, and created this issue describing how best to support it. Should be in upcoming 0.20. I am not a big fan of providing a flag on the index API (for example) to control it.

On Oct 19, 2012, at 9:07 AM, Klaus Brunner [klaus.brunner@gmail.com](mailto:klaus.brunner@gmail.com) wrote:

> As far as I can see from the docs and the Java API, automatic index creation can only be disabled globally (per node). For my use case, it would be extremely useful to specify this either for certain kinds of indexes (via index template?) or even on a request basis (i.e. with each indexing request).
> 
> Background: we're using an alias to point to one "active" index out of several. If none of the indexes have the "active" alias, we don't want an index of that name to be created accidentally when trying to add documents. We could simply check for alias existence before indexing, but that obviously invites a race condition.
> 
> OTOH, we could disable automatic index creation, but we really need that for another kind of index. Running several separate ES instances would be a waste.
> 
> Is there any existing API call I've missed to solve this problem?
> 
> Thanks
> 
> Klaus
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Klaus\_Brunner](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@Klaus\_Brunner](https://discuss.elastic.co/u/Klaus_Brunner)\
**Post date:** [October 21, 2012, 2:21am UTC](https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419/3 "2012-10-21T02:21:34Z")

</div>

On Sunday, 21 October 2012 02:25:54 UTC+2, kimchy wrote:

> I think this request makes a lot of sense. Thought a bit about how to  
> expose it, and created this issue describing how best to support it. Should  
> be in upcoming 0.20. I am not a big fan of providing a flag on the index  
> API (for example) to control it.

Great. The approach outlined in  
[Auto create index to support white/black lists of index patterns · Issue #2344 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/2344) should  
definitely work for us.

Thanks!

Klaus

--

---

<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:07am UTC](https://discuss.elastic.co/t/disable-automatic-index-creation-per-request/9419/4 "2017-07-06T03:07:44Z")

</div>


