# Watcher chain input example, use case

**URL:** <https://discuss.elastic.co/t/watcher-chain-input-example-use-case/37688>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [December 21, 2015, 12:03pm UTC](https://discuss.elastic.co/t/watcher-chain-input-example-use-case/37688 "2015-12-21T12:03:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mcku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcku/32/33775_2.png) [@mcku](https://discuss.elastic.co/u/mcku)\
**Post date:** [December 21, 2015, 1:50pm UTC](https://discuss.elastic.co/t/watcher-chain-input-example-use-case/37688/3 "2015-12-21T13:50:52Z")

</div>

Hi @spinscale Alex,

I am looking for something like the following. It appears that the `second` `search` in the `chain` does not get populated.

Thanks for your interest and cooperation!

```
 {
   "trigger": {
     "schedule": {
       "interval": "20s"
     }
   },
   "input": {
     "chain": {
       "inputs": [
         {
           "first": {
             "search": {
               "request": {
                 "search_type": "query_then_fetch",
                 "indices": [
                   "firstindex"
                 ],
                 "types": [],
                 "body": {
                   "query": {
                     "bool": {
                       "must": [
                         {
                           "match": {
                             "lang": "en"
                           }
                         }
                       ]
                     }
                   }
                 }
               }
             }
           }
         },
         {
           "second": {
             "search": {
               "request": {
                 "search_type": "query_then_fetch",
                 "indices": [
                   "authorshipindex"
                 ],
                 "types": [],
                 "body": {
                   "query": {
                     "bool": {
                       "must": [
                         {
                           "match": {
                             "userid": "{{ctx.payload.first.hits.hits.0._source.userid}}"
                           }
                         }
                       ]
                     }
                   }
                 }
               }
             }
           }
         }
       ]
     }
   },
   "condition": {
     "always": {}
   },
   "actions": {
     "log_error": {
       "logging": {
         "level": "info",
         "text": "first {{#ctx.payload.first.hits.hits}} lang: {{_source.lang}} --> {{#ctx.payload.second.hits.hits}} author: {{_source.author}} \n {{/ctx.payload.second.hits.hits}} \n {{/ctx.payload.first.hits.hits}} \n "
       }
     }
   }
 }
```

---

_[View the full topic](https://discuss.elastic.co/t/watcher-chain-input-example-use-case/37688)._
