Elaticsearch index shrink issue


(Sreejithps303) #1

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 https://www.elastic.co/guide/en/elasticsearch/reference/5.5/indices-shrink-index.html

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
}


(Abdon Pijpelink) #2

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.


(Sreejithps303) #3

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


(Sreejithps303) #4

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


(system) #5

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