[ad_1]
yeah you can load external json templates into elasticsearch but before proceeding for the same you have to format your json template a bit.
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field1" : "value1" }
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "field1" : "value3" }
{ "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
{ "doc" : {"field2" : "value2"} }
You can skip id if you prefer elastic guid as id, where _index and _type is the name of the index and type respectively.
then using the following curl command you can upload your json template to elastic.
$ curl -s -XPOST localhost:9200/_bulk --data-binary @path_to_file;
One thing i want to point out to you is that if your json upload file is too big, you may end up stammering your cluster , for which you may need to tune bulk upload queue size for threadpool using some batch process job.Default queue size for bulk upload is 50.
[ad_2]
solved How to load an external JSON template file into ElasticSearch