# Each hit action (with mustache ? )

**URL:** <https://discuss.elastic.co/t/each-hit-action-with-mustache/80812>\
**Category:** Elasticsearch\
**Created:** [March 31, 2017, 12:57pm UTC](https://discuss.elastic.co/t/each-hit-action-with-mustache/80812 "2017-03-31T12:57:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neron\_Le\_Velu](https://avatars.discourse-cdn.com/v4/letter/n/22d042/32.png) [@Neron\_Le\_Velu](https://discuss.elastic.co/u/Neron_Le_Velu)\
**Post date:** [March 31, 2017, 12:57pm UTC](https://discuss.elastic.co/t/each-hit-action-with-mustache/80812/1 "2017-03-31T12:57:59Z")

</div>

Hi,

trying to make 1 webhook per hit in 5.2. I test mustache (via or without inline painless line) at action level of a watch without success to replace an old _transform_ of version 2.4

is it possible to have something like this (pseudo code)

```
{{#ctx.payload.hits.hits}}
   , "actions" : {
    "dummy_post" : {
      "webhook" : {
        "method" : "POST"
        , "url" : "http://My/Server/Page.pl"
        , "body" : "Ref: {{_source.record_number}} bla bla"
        }
      }
    }
{{/ctx.payload.hits.hits}}

```

inline painless seems no working at this level ( direct error)

```
"inline": "{{#ctx.payload.hits.hits}}, \"actions\" : {\"dummy_post\" : {\"webhook\" : {\"method\" : \"POST\", \"url\" : \"http://My/Server/Page.pl\", \"body\" : \"Ref: {{_source.record_number}} bla bla\"}}}{{/ctx.payload.hits.hits}}"

```

number of hit could be high, how can i evaluate the load (where to look limitation)

---

<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:** [March 31, 2017, 1:49pm UTC](https://discuss.elastic.co/t/each-hit-action-with-mustache/80812/2 "2017-03-31T13:49:01Z")

</div>

Hey,

you cannot execute a webhook per hit in order to prevent overloading. If you want to do it, you should use a single webhook, that sends data to logstash (using the `http` input) and then use logstash to send data to several endpoints.

--Alex

---

<div class="post-metadata">

**Author:** ![Neron\_Le\_Velu](https://avatars.discourse-cdn.com/v4/letter/n/22d042/32.png) [@Neron\_Le\_Velu](https://discuss.elastic.co/u/Neron_Le_Velu)\
**Post date:** [April 4, 2017, 12:48pm UTC](https://discuss.elastic.co/t/each-hit-action-with-mustache/80812/3 "2017-04-04T12:48:07Z")

</div>

ok, thank you for the reply and explaination why.

---

<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 2, 2017, 12:48pm UTC](https://discuss.elastic.co/t/each-hit-action-with-mustache/80812/4 "2017-05-02T12:48:08Z")

</div>

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