Hi,
Can i insert like this in bulk insert,its possible
POST /countries/country/_bulk
{
"id":"1",
"country_name":"india",
"country_sort_name":"IN"
}
{
"id":"2",
"country_name":"india",
"country_sort_name":"IN"
}
Hi,
Can i insert like this in bulk insert,its possible
POST /countries/country/_bulk
{
"id":"1",
"country_name":"india",
"country_sort_name":"IN"
}
{
"id":"2",
"country_name":"india",
"country_sort_name":"IN"
}
The_bulk
API requires a specific format, which is specified here, so you will need to change your format for adhere to this.
Adding to the previous reply, here is an example (Elasticsearch 2.3.1):
Contents of "data_file.json":
{"index" : { "_index" : "my_index", "_type":"my_type"}} {"field1":"value", "field2":"value"}
(Note: There has to be is a CRLF or "ENTER" at the end of each line, even at the last line, invisible in the example above).
Command (Windows):
curl -s -XPOST http://localhost:9200/_bulk --data-binary @data_file.json
####Don't forget to set your mapping first!! It's not possible to set it after the data has been inserted!
It's off topic to talk about that here, but email me if you have further questions.
© 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.