# Run arbitrary code at ingest that is too big for Painless script

**URL:** <https://discuss.elastic.co/t/run-arbitrary-code-at-ingest-that-is-too-big-for-painless-script/342032>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [August 31, 2023, 10:08am UTC](https://discuss.elastic.co/t/run-arbitrary-code-at-ingest-that-is-too-big-for-painless-script/342032 "2023-08-31T10:08:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrihds](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jrihds](https://discuss.elastic.co/u/jrihds)\
**Post date:** [August 31, 2023, 10:08am UTC](https://discuss.elastic.co/t/run-arbitrary-code-at-ingest-that-is-too-big-for-painless-script/342032/1 "2023-08-31T10:08:16Z")

</div>

Hello,

I have a simple algorithm I want to use as part of an ingest pipeline to derive a metric from a string field. For example: "this\_is\_my\_string" and from that we derive a new field for insertion into the index which is called 'score' or similar.

The code and the constants I use as part of the calculation are 1MB and thus cannot be implemented in Painless which I think is limited to 64kB. I've experimented with the ML capability such as the BERT models etc but it seems like overkill for what is essentially 50 lines of code and 1MB of constants I need to derive the score.

Is there a feature in the Elastic ingest pipe where I can run my code?

Thank you

---

<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:** [September 28, 2023, 10:08am UTC](https://discuss.elastic.co/t/run-arbitrary-code-at-ingest-that-is-too-big-for-painless-script/342032/2 "2023-09-28T10:08:43Z")

</div>

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