-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
In earlier version of Elasticsearch (tested v7.7) we can not use regex unless the setting script.painless.regex.enabled is true.
since v7.10 the regex are allowed by default, and we will have a circuit breaker in case the regex we try to execute is too complex:
caused_by" : {
"type" : "circuit_breaking_exception",
"reason" : "[scripting] Regular expression considered too many characters,
pattern: [[a-f0-9]{32}$], limit factor: [6], char limit: [240], count: [241],
wrapped: [xxx], this limit can be changed
by changed by the [script.painless.regex.limit-factor] setting",
But If you set script.painless.regex.enabled to true this circuit breaker will not be triggered anymore and the complex regex will be accepted and executed.
We also have no documentation related to the setting "script.painless.regex.limit-factor".
Maybe we can take the doc from CompilerSettings class and add some examples and details to the documentation.
https://github.com/elastic/elasticsearch/blob/master/modules/lang-painless/src/main/java/org/elasticsearch/painless/CompilerSettings.java
* Are regexes enabled? If {@code true}, regexes are enabled and unlimited by the limit factor. If {@code false}, they are completely
* disabled. If {@code use-limit}, the default, regexes are enabled but limited in complexity according to the
* {@code script.painless.regex.limit-factor} setting.