Skip to content

Inconsistent results when mixing fieldname: { fieldname: { and fieldname.fieldname for mapping and indexing #5972

@brwe

Description

@brwe

The handling of objects in a mapping seems inconsistent. When adding fields with dots, for example afield.number, then, when indexing a document

"afield": {
    "number": 4
}

the type of "afield": { "number": is found correctly, but a second mapping for the object is added. This happens even if the indexing operation fails in case the type of "afield": { "number": does not correspond with "afield.number" as defined in the mapping.

An example is here: https://gist.github.com/brwe/11394327

There are two issue with this:

  1. In STEP 2 (indexing the object) the indexing operation is rejected but the mapping for the object is still added. I do not think this should be so (This might be related to #5798)
  2. It seems to me that when creating or merging mappings, it should be checked if pathes exist twice. For example, the following yields no error:
PUT /testindex/sometype/_mapping
{
   "sometype": {
      "properties": {
         "afield.number": {
            "type": "integer"
         },
         "afield.text": {
            "type": "string"
         },
         "afield": {
            "properties": {
               "number": {
                  "type": "string"
               }
            }
         }
      }
   }
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions