Invalid index name


#1

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 
    execution:
    [0]: index [current], type [events], id [349], message 
    [RemoteTransportException[[node-1][172.16.65.157:9300][indices:admin/create]]; 
    nested: InvalidIndexNameException[Invalid index name [current], already exists as 
    alias];]

What is the problem?


(Boaz Leskes) #2

@Alex_Davidovich which version of ES are you using?


#3

5.4.1


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


#5

@bleskes

 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!


#7

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 https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation 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.


#9

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


#11

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 https://github.com/elastic/elasticsearch/issues/27767 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.