Circuit_breaking_exception: [script] Too many dynamic script compilations within, max: [1000/5m]

I created a stored script in elasticsearch

GET _scripts/xxx-script
{
  "_id": "xxx-script",
  "found": true,
  "script": {
    "lang": "painless",
    "source": "ctx._source.a = params.a;ctx._source.b = params.b;ctx._source.c = params.c;ctx._source.d = params.d;ctx._source.e = params.@timestamp;"
  }
}

Then i try to save or update my data into a index, here is my code:

Map<String, String> map = new HashMap<>();
map.put("es.mapping.id", "_id");
map.put(ConfigurationOptions.ES_WRITE_OPERATION, "upsert");

map.put(ConfigurationOptions.ES_UPDATE_SCRIPT_PARAMS, "a:a,b:b,c:c,d:d,@timestamp:for_update_time");
map.put(ConfigurationOptions.ES_UPDATE_SCRIPT_STORED, "xxx-script");
JavaEsSparkSQL.saveToEs(repartition, outputIndex, map);

It always reports this error

circuit_breaking_exception: [script] Too many dynamic script compilations within, max: [1000/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.update.max_compilations_rate] 

How to solve it?

Thank you

I've confirm only one script_ in this cluster

GET _cluster/state/metadata?pretty&filter_path=**.stored_scripts

Take a look at this example and model yours after it with the syntax for the params see if that makes a difference ... right now it seems it is compiling every time

source": "ctx._source.a = params['a'];...

1 Like

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