Return array's elements as separate entities in result and sort them per whole query

Hi. I have next mapping for index documents:

{
    "mappings": {
        "domain": {
            "properties": {
                "placementid": {
                    "include_in_all": true,
                    "type": "keyword"
                },
                "domain": {
                    "properties": {
                        "name": {
                            "include_in_all": true,
                            "type": "keyword"
                        }
                    }
                }
            }
        }
    }
}

So each domainset can have up to 500 elements in domain array. E.g. next there are two documents in the index.

[
    {
        "_source": {
            "placementid": "5b4f11a1379e37000192a14c",
            "domain": [
                {
                    "name": "test.example.com"
                },
                {
                    "name": "maks.example.com"
                }
            ]
        }
    },
    {
        "_source": {
            "placementid": "5b4f11a1379e37000192a14d",
            "domain": [
                {
                    "name": "alpha.example.com"
                },
                {
                    "name": "zet.example.com"
                }
            ]
        }
    }
]

Using search I need to have domain.name's to be returned as separate entries in result set to be able to sort them globally (not in scope of main document). So that searching by domain.name:exmple.com and sorting in ascenging order I would have next result:
alpha.example.com
maks.example.com
test.example.com
zet.example.com

Is it able to have such search in current index structure? If yes, could someone show the search example for this case?

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