Elasticsearch: Allow Painless's maxLoopCounter to be set

Created on 8 Mar 2018  路  5Comments  路  Source: elastic/elasticsearch

Describe the feature:
We have counter which bounds the maximum number of internal statement executions in Painless. That number (maxLoopCounter) has gone from 10,000 to 1,000,000 as we've realized it's not large enough. Today, again, we have users hitting the upper bound ("The maximum number of statements that can be executed in a loop has been reached") and asking to increase the number.

Inevitably, users will get this number wrong and some central cluster administrator will see it as a super-long-running-CPU-intensive query, so I'm against it being set at index/query time. However, I did want to open up an issue to discuss the idea of allowing this to be set at the cluster-level setting, which may allow those administering their ES cluster to choose the correct value.

:CorInfrScripting >enhancement CorInfra

Most helpful comment

Definitely agree with @rjernst on that. So it's a matter of plumbing. For safety I would only allow this be set once at start up per context since allowing dynamic changes would potentially allow a user to turn off loop counting when it shouldn't be.

All 5 comments

FYI @elastic/es-core-infra.

I don't think this should be a cluster level setting, but instead a per context value. Different types of scripts have different values that make sense. In a scoring script, we should go back to 10000 (or less even). In scripted fields, we can go much higher since this only operates on top N. I think we should start here, and then revisit based on future feedback with the new values in mind.

I don't think this should be a cluster level setting, but instead a per context value.

That actually makes a lot more sense to me. +1

Definitely agree with @rjernst on that. So it's a matter of plumbing. For safety I would only allow this be set once at start up per context since allowing dynamic changes would potentially allow a user to turn off loop counting when it shouldn't be.

Our team encountered this problem. We're using version 7.6. Is there any chance to set 'maxLoopCounter '?

Was this page helpful?
0 / 5 - 0 ratings