JSON Bulk import to Elasticstearch

后端 未结 5 1066
长发绾君心
长发绾君心 2020-12-13 13:03

Elasticsearch Bulk import.

I need to import the Products as individual items.

I have a json file that looks similar to the following:

{
   \"         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 13:38

    I was able to add the necessary headers with the following sed script:

    sed -e 's/^/{ "index" : {} }\n/' -i products.json
    

    This will add an empty index above each line in the file. An empty index is allowed as long as the index and type are specified in the URL. After that, the proper call would be

    curl -s -XPOST http://localhost:9200/cp/products/_bulk --data-binary @products.json
    

提交回复
热议问题