Skip to content

Wrong mapping using a nested object with same name as its type #3005

@javanna

Description

@javanna

When I index a document in elasticsearch 0.90.0 and I have nested objects, one of which has the same name as its type, the automatically submitted mapping is wrong and basic queries don't work anymore.

Here is the curl recreation: https://gist.github.com/javanna/5531326 .

Indexing an object like this under the "type" type, with empty mapping:

{
  "type": {
    "id" : "test id",
    "title" : "test title"  
  },
  "type2" : {
    "id" : "test"
  }
}

The updated mapping becomes the following:

{
  "type" : {
    "properties" : {
      "id" : {
        "type" : "string"
      },
      "title" : {
        "type" : "string"
      }
    }
  }
}

I would expect to see a type2 nested object but I can't find it, and any query on the nested type2 object doesn't return any result.
The problem seems to be caused by the name of the type used to index the document, which is the same as the name of one the nested objects. If I change that I don't see any problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions