How to filter within a nested Property without change the result

Hey,

how can i filter within a nested Property without change the result count?

Hit Example:

"_index": "1000",
"_type": "example",
"_id": "1337",
"_score": 1234,
"_source": {
    "id": 1337,
    "texts": [
        {
            "name": "FooBar",
            "lang": "de",
            "referrer":1
        },
        {
            "name": "FooBar",
            "lang": "de",
            "referrer":2
        },
        {
            "name": "FooBar",
            "lang": "en",
            "referrer":1
        },

But I just want certain text, filter by referrer and lang for every hit without to filter any other values of the hits.

I running on version 2.3 on AWS

Thanks helping me,
Dominik Malsch

Push. Is this even possible?

What does your query look like so far?

I have no query so far, because i want to now this function exist.

OK, got it. Then you might want to look at the nested type in the mapping.

Note that depending on your use-case, an alternative could be to denormalize your documents to look like:

{
    "parent_id": 1337,
    "name": "FooBar",
    "lang": "de",
    "referrer":1
}

And then run a cardinality aggregation to compute the number of unique parent_ids.

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