Make a copy of a document (index template)

Hi,

I want to make a copy of a document. How can I do that?
My main interest is to create a index template similar to logstash-.*
So, I would like to copy the template into another duplicate template.

Can you please suggest how can I do this.

If you want to make a copy of the logstash template then you can the file elasticsearch-template.json from the logstash installation. Otherwise you need to use:

  1. curl -XGET http://localhost:9200/_template/template_name > template.json

  2. Edit template.json and remove the the second line which is "template_name: {" and the second last line which is "}".

  3. Make any changes you want then add it with a new name:

curl -XPUT http://localhost:9200/_template/new_template_name -d @template.json

2 Likes

Thanks a ton @msimos . It worked.