Skip to content

Rename processor does not like fieldnames with dots in them #37507

@ycombinator

Description

@ycombinator

I'm not entirely sure if this is a bug or an enhancement or neither (working as designed). So marking this as discuss for now.

Consider this pipeline simulation:

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "foo.bar": 17
      }
    }],
    "pipeline": {
      "processors": [
        {
          "rename": {
            "field": "foo.bar",
            "target_field": "baz"
          }
        }
      ]
    }
}

This will return this error response:

{
  "docs" : [
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "exception",
            "reason" : "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: field [foo.bar] doesn't exist",
            "header" : {
              "processor_type" : "rename"
            }
          }
        ],
        "type" : "exception",
        "reason" : "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: field [foo.bar] doesn't exist",
        "caused_by" : {
          "type" : "illegal_argument_exception",
          "reason" : "java.lang.IllegalArgumentException: field [foo.bar] doesn't exist",
          "caused_by" : {
            "type" : "illegal_argument_exception",
            "reason" : "field [foo.bar] doesn't exist"
          }
        },
        "header" : {
          "processor_type" : "rename"
        }
      }
    }
  ]
}

However, if we first expand the foo.bar field using the dot_expander processor, it works as expected:

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "foo.bar": 17
      }
    }],
    "pipeline": {
      "processors": [
        {
          "dot_expander": {
            "field": "foo.bar"
          }
        },
        {
          "rename": {
            "field": "foo.bar",
            "target_field": "baz"
          }
        }
      ]
    }
}

Successful response:

{
  "docs" : [
    {
      "doc" : {
        "_index" : "_index",
        "_type" : "_type",
        "_id" : "_id",
        "_source" : {
          "baz" : 17,
          "foo" : { }
        },
        "_ingest" : {
          "timestamp" : "2019-01-15T22:42:20.90721Z"
        }
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions