is there any way to import a json file(contains 100 documents) in elasticsearch server.?

前端 未结 9 1698
孤街浪徒
孤街浪徒 2020-12-04 10:39

Is there any way to import a JSON file (contains 100 documents) in elasticsearch server? I want to import a big json file into es-server..

9条回答
  •  -上瘾入骨i
    2020-12-04 11:00

    You should use Bulk API. Note that you will need to add a header line before each json document.

    $ cat requests
    { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
    { "field1" : "value1" }
    $ curl -s -XPOST localhost:9200/_bulk --data-binary @requests; echo
    {"took":7,"items":[{"create":{"_index":"test","_type":"type1","_id":"1","_version":1,"ok":true}}]}
    

提交回复
热议问题