Illegal_argument_exception when copying settings to a new index

I tried to duplicate an index with
curl -XGET https://$USER:$PASS@$(hostname -f):9200/.kibana >_index.json
sed -e 's|.kibana|.kibana2|g' -i _index.json
curl -XPUT https://$USER:$PASS@$(hostname -f):9200/.kibana2 -H "Content-Type: application/json" -d @_index.json

and I got the above error for "unknown setting [index..kibana2.mappings.doc.dynamic]". Even when I try to do it step by step, e.g.
curl -XPUT https://$USER:$PASS@$(hostname -f):9200/.kibana2
curl -XGET https://$USER:$PASS@$(hostname -f):9200/.kibana/_settings >_settings.json
sed -e 's|.kibana|.kibana2|g' -i _settings.json
curl -XPUT https://$USER:$PASS@$(hostname -f):9200/.kibana2/_settings -H "Content-Type: application/json" -d @_settings.json

I am getting the error for "unknown setting [index..kibana2.settings.index.auto_expand_replicas]".

Is there a way that I can export/import those settings correctly?

I am currently working on 6.2.4

The problem is here index..kibana2.mappings.doc.dynamic

You should rewrite the way you create the index settings.

PUT /.kibana2/_settings
{
    "index" : {
        "auto_expand_replicas" : WHATEVER
    }
}

Hello David,

thanks for the fast reply. I did that by hand editing the json file I got from the get request. However, there are more fields popping up, like "index.creation_date" which have been exported by the GET before and which have to be removed manually. Is there some way I can tell elasticsearch to skip those problematic fields when doing the GET?

Can you share the exact command (content) you are sending to elasticsearch?

Instead of the sed command, I now used an editor to remove the {".kibana": at the beginning and the closing bracket at the end.

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