Elasticsearch 5.1 Bulk Action

78 views Asked by At

I'm try to make a bulk update

Method: Post Url: /customer/external/_bulk

Json Body:

{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }

Id 1 is updated but id 2 didnt update. I dont know why?

Response is here:

{
  "took": 138,
  "errors": false,
  "items": [
    {
      "index": {
        "_index": "customer",
        "_type": "external",
        "_id": "1",
        "_version": 15,
        "result": "updated",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "created": false,
        "status": 200
      }
    }
  ]
}
1

There are 1 answers

0
Kulasangar On BEST ANSWER

As @Val mentioned, you should be having the new line character \n at the end of the last line in your json body:

{"index":{"_id":"1"}}
{"name": "John Doe" }
{"index":{"_id":"2"}}
{"name": "Jane Doe" }\n

as per mentioned in bulk_api. Hope it helps!