# How to run more than one Scripts independently

**URL:** <https://discuss.elastic.co/t/how-to-run-more-than-one-scripts-independently/150037>\
**Category:** Elasticsearch\
**Created:** [September 26, 2018, 2:56pm UTC](https://discuss.elastic.co/t/how-to-run-more-than-one-scripts-independently/150037 "2018-09-26T14:56:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Data\_Statistics](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/data_statistics/32/34755_2.png) [@Data\_Statistics](https://discuss.elastic.co/u/Data_Statistics)\
**Post date:** [September 26, 2018, 2:56pm UTC](https://discuss.elastic.co/t/how-to-run-more-than-one-scripts-independently/150037/1 "2018-09-26T14:56:46Z")

</div>

Hi,

i would like to know how to have more than one script in same code, which i need to run them when the search match.

my code is (only script part, before i have the match part that is running ok)

```
   "script": {"source":"if ('"+`${param_marca}`+ "'!= '') {ctx._source.marca_possivel = '" +`${param_marca}`+"'} else {ctx.op = 'noop'} "
   },

   "script": {"source":"if ('"+`${param_modelo1}`+ "'!= '') {ctx._source.modelo1_possivel = '" +`${param_modelo1}`+"'} else {ctx.op = 'noop'} "
   },

   "script": {"source":"if ('"+`${param_modelo2}`+ "'!= '') {ctx._source.modelo2_possivel = '" +`${param_modelo2}`+"'} else {ctx.op = 'noop'} "
   },

   "script": {"source":"if ('"+`${param_modelo3}`+ "'!= '') {ctx._source.modelo3_possivel = '" +`${param_modelo3}`+"'} else {ctx.op = 'noop'} "
   },

   "script": {"source":"if ('"+`${param_modelo4}`+ "'!= '') {ctx._source.modelo4_possivel = '" +`${param_modelo4}`+"'} else {ctx.op = 'noop'} "
   },

   "script": {"source":"if ('"+`${param_modelo5}`+ "'!= '') {ctx._source.modelo5_possivel = '" +`${param_modelo5}`+"'} else {ctx.op = 'noop'} "
    }

```

this code execute only the last script, and ignore the previous one.

Any friend to help me?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [September 26, 2018, 9:34pm UTC](https://discuss.elastic.co/t/how-to-run-more-than-one-scripts-independently/150037/2 "2018-09-26T21:34:12Z")

</div>

What api are you trying to run a script in? In general, only one script is meant to be consumed within each api that supports scripts.

---

<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:** [October 24, 2018, 9:34pm UTC](https://discuss.elastic.co/t/how-to-run-more-than-one-scripts-independently/150037/3 "2018-10-24T21:34:21Z")

</div>

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