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

Mapping update for “date_range” field type is not idempotent #1921

Closed
roman-qu opened this issue Jan 17, 2022 · 4 comments · Fixed by #2094
Closed

Mapping update for “date_range” field type is not idempotent #1921

roman-qu opened this issue Jan 17, 2022 · 4 comments · Fixed by #2094
Labels
bug Something isn't working Indexing & Search

Comments

@roman-qu
Copy link

Describe the bug
OS does not allow to update date_range fields with exact same mapping settings and responds with 500.
That is known issue for ElasticSearch version 7.10 which OpenSearch used for fork. It was resolved in version 7.11. Link to issue created for ElasticSearch -> elastic/elasticsearch#69012

To Reproduce
Steps to reproduce the behavior:

  1. Create an index curl -XPUT http://localhost:9200/test_index

  2. Add a mapping for the field with date_range type.
    curl -XPUT http://localhost:9200/test_index/_mapping \ -H 'Content-Type: application/json' \ -d '{"properties": {"range": {"type": "date_range", "format": "yyyy-MM-dd"}}}'

  3. Update the same field using the same mapping settings - repeat the previous request

curl -XPUT http://localhost:9200/test_index/_mapping \
-H 'Content-Type: application/json' \
-d '{"properties": {"range": {"type": "date_range", "format": "yyyy-MM-dd"}}}'

#response:
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_state_exception",
        "reason" : "[index.version.created] is not present in the index settings for index with UUID [null]"
      }
    ],
    "type" : "illegal_state_exception",
    "reason" : "[index.version.created] is not present in the index settings for index with UUID [null]"
  },
  "status" : 500
}

Expected behavior
Should allow to update existed mapping.

Plugins
No extra plugins

Host/Environment (please complete the following information):

  • OpenSearch version 1.2.3 and 1.1.0

Additional context
We encountered that issue during using the dynamic_templates feature in combination with date_range fields. Under the hood, the Dynamic templates feature performs the same field mapping update, but implicitly, while indexing a new document.
Issue might be fixed in 7.11 version as part of this refactoring elastic/elasticsearch#64635

@roman-qu roman-qu added bug Something isn't working untriaged labels Jan 17, 2022
@reta
Copy link
Collaborator

reta commented Feb 10, 2022

@anasalkouz @dblock picking this one

@dblock
Copy link
Member

dblock commented Mar 10, 2023

Which versions did we release this fix in? Can't seem to find it in release notes.

@andrross
Copy link
Member

andrross commented Mar 10, 2023

@dblock From browsing the commit history, it was first released in 1.3.0 an subsequently made it into 2.0 as well.

@andrross
Copy link
Member

It is in the 1.3.0 release notes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Indexing & Search
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants