Elasticsearch Bulk Json
--one document
curl -X POST "http://localhost:9200/educative/_doc/?pretty" -H 'Content-Type: application/json' -d'
{ "articleName" : "elasticsearch-intro" }
'
--multiple documents
curl -X POST "http://localhost:9200/_bulk?pretty" -H 'Content-Type: application/json' -d'
{ "index" : { "_index" : "educative"} }
{ "articleName" : "elasticsearch-intro" }
{ "index" : { "_index" : "educative"} }
{ "articleName" : "elasticsearch-insert-data" }
{ "index" : { "_index" : "educative"} }
{ "articleName" : "elasticsearch-query-data" }
'
-- same path
curl -s -H "Content-Type: application/x-ndjson" -XPOST http://localhost:9200/_bulk --data-binary "@data.txt"
-- path
curl -s -H "Content-Type: application/x-ndjson" -XPOST http://localhost:9200/_bulk --data-binary "@/Users/abhi/Downloads/temp/data.txt"
Antonio J. Carrasco