Initializing shards in updating non dynamic setting of Elasticsearch index

Setup: Elasticsearch 1.4.7 (I know it's old, legacy issues).

I need to update non dynamic settings of an index. We're saving some metadata of the index in the settings. Since the settings are non dynamic I need to close the index, only then update the settings and finally reopen the index again. As explained in this SO answer.

es_index = 'my_index'
data = {'settings': {'version_feed': version_feed}}
self.get_connection().indices.close(index=es_index)
self.get_connection().indices.put_settings(index=es_index, body=data)
self.get_connection().indices.open(index=es_index)
Problem occurs when trying to access (read/update) the index after the reopening. I get the following exception:

TransportError: TransportError(503, u'SearchPhaseExecutionException[Failed to execute phase [init_scan], all shards failed]')
In Head Plugin I see the cluster health is red and the index shard itself is yellow (and not green) and in state INITIALIZING.

The current index is contained in one shard while in the production environment it will be divided in four shards which might also be a problem, I'm not sure and haven't tested it in that environment.

Also, this isn't something I can do right now to solve it, for mere interest, is this issue solved or differently in more newer versions of Elasticsearch?

Refer: SO question

What settings are you trying to change?

I have some metadata of each index that I want to save in the settings of the index since it belongs to all documents of the index, it's a field I added, version_feed.

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