`document_missing_exception` on Upsert?


I use bulk update and have set "doc_as_upsert": true
However, SOMETIMES I get errors like this:

"update": {
  "_index": "artists",
  "_type": "artist",
  "_id": "fernanda-francis",
  "status": 404,
  "error": {
  "type": "document_missing_exception",
  "reason": "[artist][fernanda-francis]: document missing",
  "index_uuid": "q123-ftoS4WD3eE1j0D0ka",
  "shard": "3",
  "index": "artists"

Any ideas why this happens? Isn't it supposed to insert the doc if it doesn't exist?

ES v5.1 on AWS.


Anyone has any ideas?
Is this just me who has run into this issue?

(Mujtaba Hussain) #3

Hey @skilledDeveloper,

Any chance you could show us the upsert code?


I use elasticsearch npm package and send something like the followings via bulk method:

  var artist = {...};
  var firstLine = {
    update: {
      _index: "artists",
      _type: "artist",
      _id: artist.id,
  var secondLine = {
    "doc": artist
    "doc_as_upsert": true

    body: [firstLine, secondLine]
  }, function (err, resp) {
    // ...


Any ideas?

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.