It seems mapping update for "date_range" field type is not idempotent

Hi. Want to confirm the issue before posting it on github. ES does not allow to update date_range field with exact same mapping settings and responds with 500. Tried with docker container (Docker Hub) 7.10.1 and 7.10.2.
Here are the steps to reproduce:

### add new index
$ curl -XPUT http://localhost:29200/test_index
{"acknowledged":true,"shards_acknowledged":true,"index":"test_index"}

### check settings
$ curl -XGET http://localhost:29200/test_index
{
  "test_index": {
    "aliases": {},
    "mappings": {},
    "settings": {
      "index": {
        "creation_date": "1612290812518",
        "number_of_shards": "1",
        "number_of_replicas": "1",
        "uuid": "jQ2IEe5VTkKgWVnBfDxvoA",
        "version": {
          "created": "7100299"
        },
        "provided_name": "test_index"
      }
    }
  }
}

### add date_range field
$ curl -XPUT http://localhost:29200/test_index/_mapping -H 'Content-Type: application/json' -d '{"properties": {"range": {"type": "date_range", "format": "yyyy-MM-dd"}}}'
{"acknowledged":true}

### ensure mapping is updated
$ curl -XGET http://localhost:29200/test_index/_mapping
{
  "test_index": {
    "mappings": {
      "properties": {
        "range": {
          "type": "date_range",
          "format": "yyyy-MM-dd"
        }
      }
    }
  }
}

### try to put exact same settings for "range" field
$ curl -XPUT http://localhost:29200/test_index/_mapping -H 'Content-Type: application/json' -d '{"properties": {"range": {"type": "date_range", "format": "yyyy-MM-dd"}}}'
{
  "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
}

Expect to see just confirmation, but get that odd error. Btv, this does not happen with integer or keyword fields.

the issue is fixed in 7.11.0

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.