Skip to content

[BUG] Simulate ingest pipeline API throws illegal_argument_exception if remove processor is used #11604

@gaobinlong

Description

@gaobinlong

Describe the bug

When calling simulate ingest pipeline API, if the remove processor is used and the metadata field _version_type is not specified for the document, then the API always throws illegal_argument_exception which is not as expected.

This bug relates to this line which was added in this PR: #10895 :

String versionType = document.getFieldValue(IngestDocument.Metadata.VERSION_TYPE.getFieldName(), String.class);

I'll open a PR to fix this bug and add some yml test for it.

To Reproduce
Steps to reproduce the behavior:

POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      {
        "remove": {
          "field": "foo"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "foo": "bar"
      }
    }
  ]
}

Expected behavior
Simulate ingest pipeline API runs well no matter the metadata field _version_type is specified or not.

Host/Environment (please complete the following information):

  • OS: [macOS]
  • Version [main]

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workingv2.12.0Issues and PRs related to version 2.12.0v3.0.0Issues and PRs related to version 3.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions