Skip to content

Error: failed to parse field [...] of type [date] when painless script updates unrelated field #108977

@pmishev

Description

@pmishev

Elasticsearch Version

7.17.12

Installed Plugins

No response

Java Version

bundled

OS Version

Linux aa933ae49f18 5.15.49-linuxkit #1 SMP Tue Sep 13 07:51:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Problem Description

When trying to delete a field from an index, which contains an epoch_second date field with a decimal number, an unexpected error occurs on the date field and the deletion doesn't happen.

Seems like in a certain scenario, ES does not recognise decimal numbers in the scientific notation it itself saves the data in.

Steps to Reproduce

PUT /test_ts
{
  "mappings": {
    "properties": {
      "update_datetime" : {
        "type" : "date",
        "format" : "epoch_second"
      },
      "is_private" : {
        "type" : "boolean"
      }
    }
  }
}
POST test_ts/_doc/1
{
  "update_datetime": 1716462600.37034
}
POST test_ts/_update_by_query
{
  "script": {
    "source": "ctx._source.remove('is_private');",
    "lang": "painless"
  }
}

Results in:

failed to parse field [update_datetime] of type [date] in document with id '1'. Preview of field's value: '1.71646260037034E9'

Strangely reindexing works fine with no errors:

POST _reindex
{
  "source": {
    "index": "test_ts"
  },
  "dest": {
    "index": "test_ts_1"
  }
}

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