Skip to content

ingest: upsert with drop processor returns error #36746

@jakelandis

Description

@jakelandis

If performing an upsert with a default pipeline, and that default pipeline drops the document, an error will be returned to the client.

This is a minor bug since the end result is the same, the document is not indexed. However, it can pollute error logs, cause confusion, and have a minor performance penalty due to the exception and logging.

Both normal upsert and bulk upsert will error, but with different signatures

DELETE test
PUT test
{
  "settings": {
    "index.default_pipeline": "dropper"
  }
}
PUT _ingest/pipeline/dropper
{
  "processors": [
    {
      "drop": {}
    }
  ]
}

Non-bulk upsert:

POST test/doc/1/_update
{
  "script":{
    "source": "ctx._source.foo = 'bar'" 
  },
  "upsert" :{
    "foo" : "bar"
  }
}

Results in

{
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[node-0][127.0.0.1:9300][indices:data/write/update[s]]"
      }
    ],
    "type": "class_cast_exception",
    "reason": "class org.elasticsearch.action.update.UpdateResponse cannot be cast to class org.elasticsearch.action.index.IndexResponse (org.elasticsearch.action.update.UpdateResponse and org.elasticsearch.action.index.IndexResponse are in unnamed module of loader 'app')"
  },
  "status": 500
}

and bulk upsert results in

    {
      "index" : {
        "_index" : null,
        "_type" : null,
        "_id" : null,
        "status" : 500,
        "error" : {
          "type" : "null_pointer_exception",
          "reason" : null
        }
      }
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions