Elasticsearch: Unable to change enabled setting when update mapping

Created on 4 Jan 2018  路  6Comments  路  Source: elastic/elasticsearch

Steps to reproduce

  1. Create a new index with enabled=false
curl -XPUT -H 'Content-Type:application/json' 'localhost:9200/twitter' -d '
{
  "mappings": {
    "doc": {
      "properties": {
        "session": {
          "type": "object",
          "enabled": false
        }
      }
    }
  }
}'
  1. Update mapping with enabled=true and received an acknowledgment
curl -XPOST -H 'Content-Type:application/json' 'localhost:9200/twitter/_mapping/doc' -d '
{
  "properties": {
    "session": {
      "type": "object",
      "enabled": true
    }
  }
}'
  1. Query the mapping
curl 'localhost:9200/twitter/_mapping/doc'

{"twitter":{"mappings":{"doc":{"properties":{"session":{"type":"object","enabled":false}}}}}}

I am not sure if we support updating enabled attribute but we should not acknowledge if the update does not take effect.

:SearcMapping >bug

Most helpful comment

The code seems to assume this property is updateable too.

That said maybe this bug gives us an opportunity to reconsider this. Enabling a disabled object means that all sub fields indexed prior to the enablement of the object will be ignored, but not those indexed after the object has been enabled. This can make issues harder to track, and could create all kinds of weird situations, like indices that refuse to reindex with the same mappings, etc. I can't find the issue but I believe the same argument made us disallow updating the date format on date fields in the past.

All 6 comments

The code seems to assume this property is updateable too.

That said maybe this bug gives us an opportunity to reconsider this. Enabling a disabled object means that all sub fields indexed prior to the enablement of the object will be ignored, but not those indexed after the object has been enabled. This can make issues harder to track, and could create all kinds of weird situations, like indices that refuse to reindex with the same mappings, etc. I can't find the issue but I believe the same argument made us disallow updating the date format on date fields in the past.

We disallowed updating the date format in https://github.com/elastic/elasticsearch/issues/25271.

@jpountz I understand your argument, but wouldn't that same logic also apply to the "dynamic" attribute then?

Indeed. true and strict are fine, but not false.

We are discussing a related issue on #12366. We will come back to this one when we reach agreement on #12366.

Closed by #33933.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clintongormley picture clintongormley  路  3Comments

brwe picture brwe  路  3Comments

jpountz picture jpountz  路  3Comments

dadoonet picture dadoonet  路  3Comments

matthughes picture matthughes  路  3Comments