Restoring a snapshot adds legacy routing parameters to the index

I have taken a snapshot (from one ES 2.3 system) to another and restored it and every time, it adds to my index settings "legacy: { routing: { use_type: false, hash: { type: org.elasticsearch....DjbHashFunction}}}"

This setting is not on my original server on the snapshotted index -- why is it added? Could it cause me to have routing problems? I was able to create 2 documents on different shards (same type, same index) with the same _id value (inadvertently!)

If I try to alter the settings to remove legacy.routing.use_type or legacy.routing.hash.type, I get a failure.

Can you post the settings of the index that you are taking the snapshot for please?

{
"source_v8": {
"settings": {
"index": {
"creation_date": "1455444647523",
"uuid": "AU6WZSG5TUaizt32nRlRlA",
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "english"
},
"english_possessive_stemmer": {
"type": "stemmer",
"language": "possessive_english"
},
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": "1",
"max_gram": "20"
},
"english_stemmer": {
"type": "stemmer",
"language": "english"
}
},
"analyzer": {
"source_english_analyzer": {
"type": "custom",
"filter": [
"english_possessive_stemmer",
"asciifolding",
"lowercase",
"english_stop"
],
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"number_of_shards": "21",
"refresh_interval": "1s",
"version": {
"created": "1060099"
}
}
}
}
}

After restore:

{
"source_v8b": {
"settings": {
"index": {
"creation_date": "1455444647523",
"number_of_replicas": "1",
"uuid": "TzNmnJVYScWISpR_v6wMCw",
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "english"
},
"english_possessive_stemmer": {
"type": "stemmer",
"language": "possessive_english"
},
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": "1",
"max_gram": "20"
},
"english_stemmer": {
"type": "stemmer",
"language": "english"
}
},
"analyzer": {
"source_english_analyzer": {
"type": "custom",
"filter": [
"english_possessive_stemmer",
"asciifolding",
"lowercase",
"english_stop"
],
"tokenizer": "standard"
}
}
},
"number_of_shards": "21",
"version": {
"created": "1060099",
"upgraded": "2030399"
},
"legacy": {
"routing": {
"use_type": "false",
"hash": {
"type": "org.elasticsearch.cluster.routing.DjbHashFunction"
}
}
}
}
}
}
}

Are you sure that you go from 2.3 to 2.3? IT seems like the index was created on an older version and snapshotted it from that version, then restored into 2.3.

We changed the default routing function in elasticsearch, and the index was created before we did that. When we restore the snapshot, we read the version that the index was created against and we "ugprade" it, hence the version.upgraded bit that gets added to the settings. As part of this upgrade we make sure that the legacy hash function is being used, otherwise you wouldn't be able to get back documents by id etc. so to sum it up it is a good thing that we do it, you would have problems if we didn't do that.

I now understand that when I created the settings for the original index, I copied the settings from an older version (1.4) and included the version settings.
So even though it's running on 2.3, the index settings think it's on 1.4.
Is there a way of modifying the version in place?

HI Jason,
I think the version is ok now, but the routing setting is not. Other people had similar problems before, you can follow these instructions to fix it: https://github.com/elastic/elasticsearch/issues/18459#issuecomment-220313383 .

Cheers
Luca

Thanks so much Luca! That was it exactly.
I ended up rebuilding to a new database with settings that didn't include the version.
I did try resetting the hash type, but I guess the index wasn't closed so it didn't work.

glad to hear you solved, one way or another :wink: