# Share status between painless script per hit executions

**URL:** <https://discuss.elastic.co/t/share-status-between-painless-script-per-hit-executions/64639>\
**Category:** Elasticsearch\
**Created:** [November 1, 2016, 9:26pm UTC](https://discuss.elastic.co/t/share-status-between-painless-script-per-hit-executions/64639 "2016-11-01T21:26:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![acs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/acs/32/5158_2.png) [@acs](https://discuss.elastic.co/u/acs)\
**Post date:** [November 1, 2016, 9:26pm UTC](https://discuss.elastic.co/t/share-status-between-painless-script-per-hit-executions/64639/1 "2016-11-01T21:26:53Z")

</div>

Hi!

In painless, is it possible with script fields to have a shared status that can be used in each execution of the script for each hit?

I have seen that using:

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html)

you can do this kind of things.

Thanks!

---

<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 5, 2017, 10:07pm UTC](https://discuss.elastic.co/t/share-status-between-painless-script-per-hit-executions/64639/2 "2017-07-05T22:07:39Z")

</div>


