aquasecurity / esquery

An idiomatic Go query builder for ElasticSearch
Apache License 2.0
305 stars 56 forks source link

How to use nested query filter? #29

Open akhmadnurmuhammad opened 2 years ago

akhmadnurmuhammad commented 2 years ago

Hi all,

how to make nested query filtering parent based on nested child object, also filter the child to, something query like this?

{
    "query": {
        "bool": {
            "must": [
                {
                    "range": {
                        "date": {
                            "lt": "2018-07-05T10:00:00.000Z"
                        }
                    }               
                },
                {
                    "nested": {
                        "path": "child",
                        "query": {
                            "bool": {
                                "must_not": {
                                    "term": {
                                        "child.foo": 0
                                    }       
                                }
                            }
                        }
                    }
                }
            ]
        }
    }
}

thank in advice

Shegl commented 1 year ago

Hi all,

how to make nested query filtering parent based on nested child object, also filter the child to, something query like this?

{
    ....
}

thank in advice

Hello, Did you find a solution ?