Skip to content

date's format updateability is trappy #25271

@jpountz

Description

@jpountz

Here is a recreation:

DELETE index

PUT index
{
  "mappings": {
    "doc": {
      "properties": {
        "my_date": {
          "type": "date", 
          "format": "yyyy/MM/dd"
        }
      }
    }
  }
}

PUT index/_mapping/doc
{
  "doc": {
    "properties": {
      "my_date": {
        "type": "date", 
        "format": "yyyy-MM-dd"
      }
    }
  }
}

GET index/_mapping

date allows its format to be updated. This is trappy because then it could be changed to a format that doesn't work with already indexed documents, or even worse: a format that parses to a different date.

I think we need to ensure that the format either cannot be changed, or make it a list that is append-only so that it is only possible to append date formats.

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