# How to carry parameters in logstash es script

**URL:** <https://discuss.elastic.co/t/how-to-carry-parameters-in-logstash-es-script/178021>\
**Category:** Logstash\
**Created:** [April 23, 2019, 11:26am UTC](https://discuss.elastic.co/t/how-to-carry-parameters-in-logstash-es-script/178021 "2019-04-23T11:26:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xingzhi\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xingzhi_zhang/32/44216_2.png) [@xingzhi\_Zhang](https://discuss.elastic.co/u/xingzhi_Zhang)\
**Post date:** [April 23, 2019, 11:26am UTC](https://discuss.elastic.co/t/how-to-carry-parameters-in-logstash-es-script/178021/1 "2019-04-23T11:26:18Z")

</div>

eg.  
{  
"script": {  
"source": "if (ctx.\_source.supplier.contains(params.supplier)) { ctx.\_source.supplier.remove(ctx.\_source.supplier.indexOfparams.supplier) ;ctx.\_source.supplier.add(params.supplier) }",  
"lang": "painless",  
"params": {  
"supplier": {  
"gysmc": "test",  
"kcl": 53454  
}  
}  
}  
}

A syntax error occurred when I wrote this in script,Is there a relevant example?

---

<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 21, 2019, 11:27am UTC](https://discuss.elastic.co/t/how-to-carry-parameters-in-logstash-es-script/178021/2 "2019-05-21T11:27:05Z")

</div>

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