# Accessing Watcher Payload for Buckets

**URL:** <https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [April 21, 2017, 12:52pm UTC](https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209 "2017-04-21T12:52:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lueneburger](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lueneburger](https://discuss.elastic.co/u/lueneburger)\
**Post date:** [April 21, 2017, 12:52pm UTC](https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209/1 "2017-04-21T12:52:44Z")

</div>

HI Community,

was working on a watch to compare the 7 days for errors.

now I only got the problem, how can i access it to compared it? 😕

```
   "result": {
  "execution_time": "2017-04-21T12:32:53.804Z",
  "execution_duration": 418,
  "input": {
    "type": "search",
    "status": "success",
    "payload": {
      "_shards": {
        "total": 94,
        "failed": 0,
        "successful": 94
      },
      "hits": {
        "hits": [],
        "total": 12992972,
        "max_score": 0
      },
      "took": 416,
      "timed_out": false,
      "aggregations": {
        "servername": {
          "doc_count_error_upper_bound": 0,
          "sum_other_doc_count": 0,
          "buckets": [
            {
              "doc_count": 1142334,
              "httperror": {
                "doc_count_error_upper_bound": 0,
                "sum_other_doc_count": 0,
                "buckets": [
                  {
                    "doc_count": 197,
                    "key": "404"
                  }
                ]
              },
              "key": "cnx-api00"
            }
          ]
        }
      }
    }

```

was trying to get the doc\_count from httperror.

```
  "condition": {
"compare": {
  "ctx.payload.aggregations.servername.buckets.httperror.buckets.doc_count": {
    "lt": 600
  }
}

```

}

wasn't it possible to get the lower bucket or did I miss something?

Thanks for the Help in advance

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 21, 2017, 5:41pm UTC](https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209/2 "2017-04-21T17:41:59Z")

</div>

Hey,

as the `buckets` is an array, you have to specify an index for the elements. One of the examples uses mustache to loop through the buckets and get the first sub bucket.

[https://www.elastic.co/guide/en/x-pack/5.3/watching-meetup-data.html](https://www.elastic.co/guide/en/x-pack/5.3/watching-meetup-data.html)

I did not understand your last sentence though.

Hope this helps!

--Alex

---

<div class="post-metadata">

**Author:** ![lueneburger](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@lueneburger](https://discuss.elastic.co/u/lueneburger)\
**Post date:** [April 25, 2017, 7:04am UTC](https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209/3 "2017-04-25T07:04:59Z")

</div>

Hey spinscale,

yep thanks, now it works 🙂

was already confused at the last sentence for late friday.

---

<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:** [May 23, 2017, 7:15am UTC](https://discuss.elastic.co/t/accessing-watcher-payload-for-buckets/83209/4 "2017-05-23T07:15:55Z")

</div>

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