Make a copy of a document (index template)

(Vilas Reddy Podduturi) #1


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.

Copy template from elastic to elastic
(Mike Simos) #2

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

(Vilas Reddy Podduturi) #3

Thanks a ton @msimos . It worked.

(system) #4