Elasticsearch bulk index api via rest endpoint

后端 未结 2 691
死守一世寂寞
死守一世寂寞 2020-12-11 02:59

Here is my request:

POST /_bulk
{ \"index\" : { \"_index\" : \"test\", \"_type\" : \"type1\", \"_id\" : \"1\" } }
{\"firstname\":\"first_name1\",\"lastname\"         


        
2条回答
  •  时光取名叫无心
    2020-12-11 04:01

    You're simply missing an action line for the second and third documents, try like this:

    POST /_bulk
    { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
    {"firstname":"first_name1","lastname":"last_name1"}
    { "index" : { "_index" : "test", "_type" : "type1", "_id" : "2" } }
    {"firstname":"first_name2","lastname":"last_name2"}
    { "index" : { "_index" : "test", "_type" : "type1", "_id" : "3" } }
    {"firstname":"first_name3","lastname":"last_name3"}
    

提交回复
热议问题