Skip to content

Disabling _source prevents any further updates to mapping #15997

@polyfractal

Description

@polyfractal

It seems that if you disable the _source when first creating the index, and subsequent updates to the mapping will fail with Merge failed with failures {[Cannot update enabled setting for [_source]]}, even if the update doesn't change _source at all.

Tested on ES 2.1

{
   "name": "Domo",
   "cluster_name": "elasticsearch",
   "version": {
      "number": "2.1.0",
      "build_hash": "72cd1f1a3eee09505e036106146dc1949dc5dc87",
      "build_timestamp": "2015-11-18T22:40:03Z",
      "build_snapshot": false,
      "lucene_version": "5.3.1"
   },
   "tagline": "You Know, for Search"
}

Example

DELETE /data

PUT /data
{
    "mappings": {
        "data": {
            "_source": {
                "enabled": false
            },
            "properties": {
                "float": {
                    "type": "float"
                },
                "double": {
                    "type": "double"
                }
            }
        }
    }
}

GET /data/_mapping
{
   "data": {
      "mappings": {
         "data": {
            "_source": {
               "enabled": false
            },
            "properties": {
               "double": {
                  "type": "double"
               },
               "float": {
                  "type": "float"
               }
            }
         }
      }
   }
}

All good, but if we try to update the mapping:

PUT /data/_mapping/data
{
   "properties": {
      "long": {
         "type": "long"
      }
   }
}
{
   "error": {
      "root_cause": [
         {
            "type": "merge_mapping_exception",
            "reason": "Merge failed with failures {[Cannot update enabled setting for [_source]]}"
         }
      ],
      "type": "merge_mapping_exception",
      "reason": "Merge failed with failures {[Cannot update enabled setting for [_source]]}"
   },
   "status": 400
}

If you repeat the process without touching _source, everything works as expected:

DELETE /data

PUT /data
{
    "mappings": {
        "data": {
            "properties": {
                "float": {
                    "type": "float"
                },
                "double": {
                    "type": "double"
                }
            }
        }
    }
}

GET /data/_mapping

PUT /data/_mapping/data
{
   "properties": {
      "long": {
         "type": "long"
      }
   }
}

GET /data/_mapping
{
   "data": {
      "mappings": {
         "data": {
            "properties": {
               "double": {
                  "type": "double"
               },
               "float": {
                  "type": "float"
               },
               "long": {
                  "type": "long"
               }
            }
         }
      }
   }
}

And it doesn't seem to matter if you enable or disable _source, both cases will cause the error. It seems to be the presence of specifying _source that breaks future updates.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions