Disable automatic index creation per-request?


(Klaus Brunner) #1

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

--


(Shay Banon) #2

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 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

--

--


(Klaus Brunner) #3

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
https://github.com/elasticsearch/elasticsearch/issues/2344 should
definitely work for us.

Thanks!

Klaus

--


(system) #4