Elaticsearch index shrink issue

Hi ,
I am trying to shrink the indices in elasticsearch. Currenrly i have 5 primary shards and 1 replica .
I want to change it to 1 primary and 1 replica shards.
i have executed the steps mention in Shrink Index | Elasticsearch Reference [5.5] | Elastic

But while shrinking i am getting below error. Anyone can help?

curl -XPOST -u xxxx:xxxxx 'xx.xx.xx.xx:9200/reporting-2017.08.12/_shrink/reporting-2017.08.12-reindexed?pretty' -H 'Content-Type: application/json' -d'

{
"settings": {
"index.number_of_replicas": 1,
"index.number_of_shards": 1,
"index.codec": "best_compression"
}
}
'
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "mappings are not allowed when shrinking indices, all mappings are copied from the source index"
}
],
"type" : "illegal_argument_exception",
"reason" : "mappings are not allowed when shrinking indices, all mappings are copied from the source index"
},
"status" : 400
}

Do you have any index templates that match the new index name (reporting-2017.08.12-reindexed)? There's a bug that will be fixed in 5.6 that causes index templates to be applied to the new index (https://github.com/elastic/elasticsearch/pull/25380).

In the meantime, you could make sure that the new index has a name that would not match the index template.

ok.. thanks , i will try with different name.

It is working after i changed the target index name. thanks again,

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