# Scripts may be no longer than 16384 characters

**URL:** <https://discuss.elastic.co/t/scripts-may-be-no-longer-than-16384-characters/158178>\
**Category:** Elasticsearch\
**Created:** [November 26, 2018, 12:26pm UTC](https://discuss.elastic.co/t/scripts-may-be-no-longer-than-16384-characters/158178 "2018-11-26T12:26:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bfcshop](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@bfcshop](https://discuss.elastic.co/u/bfcshop)\
**Post date:** [November 27, 2018, 9:09am UTC](https://discuss.elastic.co/t/scripts-may-be-no-longer-than-16384-characters/158178/3 "2018-11-27T09:09:10Z")

</div>

{"0":"{"error":{"root\_cause":[{"type":"script\_exception","reason":"compile error","script\_stack":,"script":"def s = ['23353':2383,'12157':2382,'12163':2381,'12166':2380,'20304':2379,'23535':2378,'12161'......,]; def id = Long.toString(doc['id'].value); return s[id];","lang":"painless"}],"type":"search\_phase\_execution\_exception","reason":"all shards failed","phase":"query","grouped":true,"failed\_shards":[{"shard":0,"index":"default\_product\_idx1","node":"tO4GMfe-QJ6joi\_GlhvV1A","reason":{"type":"query\_shard\_exception","reason":"script\_score: the script could not be loaded","index\_uuid":"k9ipkQZQRweLruAdHTIrSg","index":"default\_product\_idx1","caused\_by":{"type":"script\_exception","reason":"compile error","script\_stack":,"script":"def s = ['23353':2383,'12157':2382,'12163':2381,'12166':2380,'20304':2379,'23535':2378,'12161':2377,'12165'....]; def id = Long.toString(doc['id'].value); return s[id];","lang":"painless","caused\_by":{"type":"illegal\_argument\_exception","reason":"Scripts may be no longer than 16384 characters. The passed in script is 29931 characters. Consider using a plugin if a script longer than this length is a requirement."}}}}],"caused\_by":{"type":"script\_exception","reason":"compile error","script\_stack":,"script":"def s = ['23353':2383,'12157':2382,'12163':2381,'12166':2380,'20304':2379,'23535':2378,'12161':2377,...]; def id = Long.toString(doc['id'].value); return s[id];","lang":"painless","caused\_by":{"type":"illegal\_argument\_exception","reason":"Scripts may be no longer than 16384 characters. The passed in script is 29931 characters. Consider using a plugin if a script longer than this length is a requirement."}}},"status":400}","1":"#0 /home/bfcshop/public\_html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(279): Elasticsearch\Connections\Connection-\>process4xxError(Array, Array, Array)

---

_[View the full topic](https://discuss.elastic.co/t/scripts-may-be-no-longer-than-16384-characters/158178)._
