Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`date`'s `format` updateability is trappy #25271

Closed
jpountz opened this issue Jun 16, 2017 · 1 comment

Comments

@jpountz
Copy link
Contributor

commented Jun 16, 2017

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.

@s1monw

This comment has been minimized.

Copy link
Contributor

commented Jun 16, 2017

++ to move to an append-able list! we discussed this in fixit friday and we are convinced that we should not move to a list due to the ordering aspects. If we'd allow only adding to it but not sending the list is that we need to barf if the order changes which is weird. The right fix here is to make the date immutable and reject any updates to it.

@jpountz jpountz added help wanted and removed discuss labels Jun 16, 2017
PnPie added a commit to PnPie/elasticsearch that referenced this issue Jun 18, 2017
Make date field mapping unchangeable.

Closes elastic#25271
jpountz added a commit that referenced this issue Jul 7, 2017
Make date field mapping unchangeable.

Closes #25271
jpountz added a commit that referenced this issue Jul 7, 2017
Make date field mapping unchangeable.

Closes #25271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.