Indexing strategy for hierarchical types

Hello, I wrote a post on Friday (here) and since I didn't get a reply, I'll give it another go with a different question.

Just a quick summary (check my previous post for a more detailed explanation):
Currently on Elasticsearch 7.12.1, but I plan on upgrading to a newer version.
I have hierarchical types. Think object oriented design, inheritance of properties and all. I want to index that. I thought about indexing under separate indices in my previous post, but the first way I implemented it was with nested types.

So let's say that my structure of inheritance is as follows:

parent
    child1
      child3
    child2

What I did was call PUT on /parent/mapping with body:

{
    "properties": {
        "parent.parent_property": {
            "type": "text"
        },
        "parent.child1.child1_property": {
            "type": "text"
        },
        "parent.child1.child3.child3_property": {
            "type": "text"
        },
        "parent.child2.child2_property": {
            "type": "text"
        }
    }
}

Calling GET on /parent/_mapping nets me the following result:

{
    "parent": {
        "mappings": {
            "properties": {
                "parent": {
                    "properties": {
                        "child1": {
                            "properties": {
                                "child1_property": {
                                    "type": "text"
                                },
                                "child3": {
                                    "properties": {
                                        "child3_property": {
                                            "type": "text"
                                        }
                                    }
                                }
                            }
                        },
                        "child2": {
                            "properties": {
                                "child2_property": {
                                    "type": "text"
                                }
                            }
                        },
                        "parent_property": {
                            "type": "text"
                        }
                    }
                }
            }
        }
    }
}

My worry here is
a) whether this has anything to do with deprecated mapping types.
b) it will result in a single index. I assume it will take a performance hit

Can anyone give me any input at all?

Please don't duplicate your topics, it makes it harder to help.

Yep, posting before the weekend and expecting a reply on Monday probably isn't going to happen :wink:
For many of us, even at Elastic, responding here comes after our usual work, and certainly won't take precedence over personal time on the weekend.

Have some patience and someone will get to your question :smiley:

1 Like