Skip to content

illegal_argument_exception - unexpected metadata [op:[TEST]] in source #107209

Open
@rishabh-mmc

Description

@rishabh-mmc

Elasticsearch Version

8.12.2

Installed Plugins

No response

Java Version

bundled

OS Version

Mac OS Sonomo (14.4.1)

Problem Description

Unable to update any document when there is field named op in mapping.

Steps to Reproduce

// Create Mapping

PUT op_index_test

{
  "mappings": {
    "properties": {
      "firstName": {
        "type": "text"
      },
      "lastName": {
        "type": "text"
      },
      "op": {
        "type": "keyword"
      },
      "orgId": {
        "type": "integer"
      }
    }
  }
}

// insert data
POST op_index_test/_doc/1

{"firstName": "BQCayRMVdN", "lastName": "vVDUmYONQW", "orgId": 1, "op": ["TEST"]}

// update by query
POST op_index_test/_update_by_query

{
  "script": {
    "source": """
    if (ctx._source.orgId == 1) { ctx._source.firstName = ctx._source.firstName}
    """,
    "lang": "painless"
  },
  "query": { 
    "match": {
      "orgId": 1
    }
  }
}

Error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unexpected metadata [op:[TEST]] in source"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unexpected metadata [op:[TEST]] in source"
  },
  "status": 400
}

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions