JSON Bulk import to Elasticstearch

后端 未结 5 1063
长发绾君心
长发绾君心 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条回答
  •  Happy的楠姐
    2020-12-13 13:32

    Another option is to use json-to-es-bulk tool.

    Run the following to convert your JSON file to NDJSON:

    node ./index.js -f file.json --index index_name --type type_name
    

    It will create the request-data.txt file, which can be imported with bulk:

    curl -H "Content-Type: application/json" -XPOST "http://localhost:9200/my_index/my_type/_bulk?pretty" --data-binary "@request-data.txt"
    

提交回复
热议问题