Hi! Please I would like to create many indices at the same time with a defined pattern. Does anybody know a scipt or has a solution to do that.
Thanks
Hi! Please I would like to create many indices at the same time with a defined pattern. Does anybody know a scipt or has a solution to do that.
Thanks
I finally found it myself. For those interested... Here are two scripts in batch
1- gets all the indices names from elasticsearch and stores them in a file
curl -HContent-Type:application/json -XGET localhost:9200/_cat/indices/?h=index>indices.txt
2- Creates new indices name-based on the existing indices
for /f "tokens=*" %%a in (indices.txt) do (
curl -HContent-Type:application/json -XPUT localhost:9200/"%%a-new_one"
)
And this is the hole script in bash (that I didn't tested):
#!/bin/bash
liste_indexs=`curl -HContent-Type:application/json -XGET localhost:9200/_cat/indices > indices.txt`
for index in $liste_indexs; do
curl -HContent-Type:application/json -XPUT localhost:9200/"$index-new_one"
done
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.