# How can I use aggregation value in trigger condition

**URL:** <https://discuss.elastic.co/t/how-can-i-use-aggregation-value-in-trigger-condition/308743>\
**Category:** Elasticsearch\
**Created:** [July 3, 2022, 10:43am UTC](https://discuss.elastic.co/t/how-can-i-use-aggregation-value-in-trigger-condition/308743 "2022-07-03T10:43:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![puks\_apple](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/puks_apple/32/107257_2.png) [@puks\_apple](https://discuss.elastic.co/u/puks_apple)\
**Post date:** [July 3, 2022, 10:43am UTC](https://discuss.elastic.co/t/how-can-i-use-aggregation-value-in-trigger-condition/308743/1 "2022-07-03T10:43:09Z")

</div>

```auto

{
    "_shards": {
        "total": 1,
        "failed": 0,
        "successful": 1,
        "skipped": 0
    },
    "hits": {
        "hits": [],
        "total": {
            "value": 7,
            "relation": "eq"
        },
        "max_score": null
    },
    "took": 1,
    "timed_out": false,
    "aggregations": {
        "filters_agg": {
            "buckets": {
                "first": {
                    "gendermale": {
                        "doc_count_error_upper_bound": 0,
                        "sum_other_doc_count": 0,
                        "buckets": [
                            {
                                "doc_count": 4,
                                "key": "MALE"
                            },
                            {
                                "doc_count": 3,
                                "key": "FEMALE"
                            }
                        ]
                    },
                    "doc_count": 7,
                    "genderfemale": {
                        "doc_count_error_upper_bound": 0,
                        "sum_other_doc_count": 0,
                        "buckets": [
                            {
                                "doc_count": 4,
                                "key": "MALE"
                            },
                            {
                                "doc_count": 3,
                                "key": "FEMALE"
                            }
                        ]
                    },
                    "pass_fail": {
                        "value": 7
                    }
                }
            }
        }
    }
}

I am doing something like this but its giving error:
ctx.results[0].aggregations.gendermale.doc_cout>3

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 31, 2022, 10:44am UTC](https://discuss.elastic.co/t/how-can-i-use-aggregation-value-in-trigger-condition/308743/2 "2022-07-31T10:44:03Z")

</div>

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