Elasticsearch

Script Compilation Cache Pressure

warning
performanceUpdated Mar 2, 2026

Excessive script compilation from unique painless scripts can exhaust the compilation cache, trigger rate limiting, and impact query performance.

Recommended action:

Review script usage patterns: (1) Parameterize scripts instead of embedding values directly - use script.painless.regex.enabled:false to force parameterization, (2) Increase script.context.*.cache_max_size from default 100, (3) Reduce unique script variations - consolidate similar scripts. Monitor script.painless.compile setting (default 150/5m rate limit). For high compilation rates, consider: pre-compiling frequently used scripts, using stored scripts instead of inline, or moving complex logic to application layer. Check if ML inference or other features use scripts internally. Excessive compilations indicate inefficient query patterns that should be refactored.