Search value based on specific field as child field are dynamic

The collection looks like this

                {
                   "displayname":"unknown12"
                        "hierarchy":{
                                "username":"Nothing on",
                                "Location":"",
                                "Owner":"unknown",
                                "works": "IT"
                            }
                    } 

using a multi-match query with phrase_prefix, want to search value based on fields. The fields within the hierarchy are dynamic. Want to search field based on specific fields

        {
        "from": 0,
                "query": {
                "multi_match": {
                    "query": "Finance",
                    "type": "phrase_prefix",
                    "fields": [
                        "Location",
                        "address",
                        "hierarchy.*.",
                        "tags"
                    ]
                }
            }
    }

To search IT we should specify like hierarchy.works or for unknown hierarchy.Owner, as it is dynamic cant specify for all, trying with regex but getting an error, is there any way to get it.HOe

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.