@@ -129,3 +129,41 @@ documentation for more information.
129
129
Limit for the number of unique dynamic scripts within a certain interval
130
130
that are allowed to be compiled for a given context. Defaults to `75/5m`,
131
131
meaning 75 every 5 minutes.
132
+
133
+ [[regex-circuit-breaker]]
134
+ [discrete]
135
+ ==== Regex circuit breaker
136
+
137
+ Poorly written regular expressions can degrade cluster stability and
138
+ performance. The regex circuit breaker limits the use and complexity of
139
+ {painless}/painless-regexes.html[regex in Painless scripts].
140
+
141
+ [[script-painless-regex-enabled]]
142
+ `script.painless.regex.enabled`::
143
+ (<<static-cluster-setting,Static>>) Enables regex in Painless scripts. Accepts:
144
+
145
+ `limit` (Default):::
146
+ Enables regex but limits complexity using the
147
+ <<script-painless-regex-limit-factor,`script.painless.regex.limit-factor`>>
148
+ cluster setting.
149
+
150
+ `true`:::
151
+ Enables regex with no complexity limits. Disables the regex circuit breaker.
152
+
153
+ `false`:::
154
+ Disables regex. Any Painless script containing a regular expression returns an
155
+ error.
156
+
157
+ [[script-painless-regex-limit-factor]]
158
+ `script.painless.regex.limit-factor`::
159
+ (<<static-cluster-setting,Static>>) Limits the number of characters a regular
160
+ expression in a Painless script can consider. {es} calculates this limit by
161
+ multiplying the setting value by the script input's character length.
162
+ +
163
+ For example, the input `foobarbaz` has a character length of `9`. If
164
+ `script.painless.regex.limit-factor` is `6`, a regular expression on `foobarbaz`
165
+ can consider up to 54 (9 * 6) characters. If the expression exceeds this limit,
166
+ it triggers the regex circuit breaker and returns an error.
167
+ +
168
+ {es} only applies this limit if
169
+ <<script-painless-regex-enabled,`script.painless.regex.enabled`>> is `limit`.
0 commit comments