# Watcher that outputs the total number of snapshots in a repository

**URL:** <https://discuss.elastic.co/t/watcher-that-outputs-the-total-number-of-snapshots-in-a-repository/256244>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [November 21, 2020, 10:09pm UTC](https://discuss.elastic.co/t/watcher-that-outputs-the-total-number-of-snapshots-in-a-repository/256244 "2020-11-21T22:09:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwise29](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mwise29](https://discuss.elastic.co/u/mwise29)\
**Post date:** [November 21, 2020, 10:09pm UTC](https://discuss.elastic.co/t/watcher-that-outputs-the-total-number-of-snapshots-in-a-repository/256244/1 "2020-11-21T22:09:48Z")

</div>

How do I get the total number of snapshots from a repository with this input? I've tried ctx.payload.hits and ctx.payload.hits.value but the value is blank. Any help would be greatly appreciated.

```auto
  "input" : {
    "http" : {
      "request" : {
        "host" : "localhost",
        "port" : 9200,
        "path" : "_snapshot/<repo>/_all"
      }
    }
  }

```

---

<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:** [December 19, 2020, 10:09pm UTC](https://discuss.elastic.co/t/watcher-that-outputs-the-total-number-of-snapshots-in-a-repository/256244/2 "2020-12-19T22:09:59Z")

</div>

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