# Illegal\_argument\_exception when copying settings to a new index

**URL:** https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175
**Category:** Elasticsearch
**Created:** [July 30, 2018, 12:15pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175 "2018-07-30T12:15:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Joern\_Ott\_Schufa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joern_ott_schufa/32/33857_2.png) [@Joern\_Ott\_Schufa](https://discuss.elastic.co/u/Joern_Ott_Schufa)
#### Post date: [July 30, 2018, 12:15pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/1 "2018-07-30T12:15:11Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 30, 2018, 2:19pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/2 "2018-07-30T14:19:40Z")

</div>

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

You should rewrite the way you create the index settings.

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

```

---

<div class="post-metadata">

### Author: ![Joern\_Ott\_Schufa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joern_ott_schufa/32/33857_2.png) [@Joern\_Ott\_Schufa](https://discuss.elastic.co/u/Joern_Ott_Schufa)
#### Post date: [July 30, 2018, 2:37pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/3 "2018-07-30T14:37:01Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [July 30, 2018, 2:48pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/4 "2018-07-30T14:48:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Joern\_Ott\_Schufa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joern_ott_schufa/32/33857_2.png) [@Joern\_Ott\_Schufa](https://discuss.elastic.co/u/Joern_Ott_Schufa)
#### Post date: [July 31, 2018, 6:46am UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/5 "2018-07-31T06:46:56Z")

</div>

> [@Joern\_Ott\_Schufa](#):
>
> curl -XGET https://$USER:$PASS@$(hostname -f):9200/.kibana/\_settings \>\_settings.json  
> $EDITOR \_settings.json  
> curl -XPUT https://$USER:$PASS@$(hostname -f):9200/.kibana2/\_settings -H "Content-Type: application/json" -d @\_settings.json

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 28, 2018, 6:58am UTC](https://discuss.elastic.co/t/illegal-argument-exception-when-copying-settings-to-a-new-index/142175/6 "2018-08-28T06:58:33Z")

</div>

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