Invalid index name


I have a 3 nodes cluster with 1 primary shards on 1 node and 1 replica on each other node.
My index has a name and an alias "current".
I am bulk inserting into the master only via the alias name "current".
That's working just fine. When my test kills the master in order to check failover,
the next time I try to bulk insert I get Invalid index name [current], already exists as alias:

    ERROR 2017-12-11 11:22:23,310 [EventPublisher~i58] : 
    ElasticManagementClient(ElasticManagementClient.create:290) - failure in bulk 
    [0]: index [current], type [events], id [349], message 
    nested: InvalidIndexNameException[Invalid index name [current], already exists as 

What is the problem?

(Boaz Leskes) #2

@Alex_Davidovich which version of ES are you using?



(Boaz Leskes) #4

OK. Do you set the minimum_master_node setting? I'm curious why the node that received an indexing command for the current index/alias decided it needs to reach out to the master to create the index. Normally it should know the alias exist because it's part of the cluster.



 discovery.zen.minimum_master_nodes: 2
 discovery.zen.ping_timeout: 1s
 transport.tcp.connect_timeout: 5s

I just want to add that I am using transport client and this is my code:

for (Map.Entry<Long, String> eventJson : eventJsons.entrySet()) {

 indexRequestBuilder = client().prepareIndex(EventsConstants.CURRENT_ALIAS, EventsConstants.BASE_TYPE, eventJson.getKey().toString());
 bulkRequestBuilder.add(indexRequestBuilder.setSource(eventJson.getValue(), XContentType.JSON).setCreate(true).setTimeout(TIMEOUT));

(Boaz Leskes) #6

Thanks @Alex_Davidovich. This is a two layered bug. First there should not be an attempt to create an index before the node fully joined the cluster. On top of that, once such an attempt fails, it shouldn't fail the indexing operation. We will open an issue and fix this. Thanks for bringing it up!


Thank you but I think that I don't fully understand.
First of all, I am trying to index a document and not create an index. So why is ES trying to create one? In addition, do you think that a sleep + retry will be enough yo bypass the problem? Is there a way to figure out that ES is failing over via API?

(Boaz Leskes) #8

So why is ES trying to create one?

This is a default ES behavior. See for details and how to change that.

In addition, do you think that a sleep + retry will be enough yo bypass the problem

that should by pass the problem. An alternative is disable auto index creation.


Thank you, but why ES doesn't that the index and alias do exist? Bug or expected behavior suring fail-over?

(Boaz Leskes) #10

Bug or expected behavior suring fail-over?

This is a bug. I presume you restart the master? When the node starts up it forgets what it had and needs to rejoin the cluster. Any indexing during that period will run into this problem


I am not sure whether or not the test restarts the node or only kills it, but thats good to know. Thank you very much for the help

(Lee Hinman) #12

Thanks for reporting this! I've opened an issue for it at and I'll work on a fix for this.

(Bob) #13

I have had the same error occur when doing a rollover and it seems to happen at random.

(system) #14

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.