All Questions
Elasticsearch hard

Why is a `script` query using 'Painless' significantly slower than a standard Lucene query (e.g., `match` or `range`)?

  1. A Painless scripts are interpreted line-by-line using a legacy Ruby engine.
  2. B Per-Document Execution: Lucene queries use pre-computed inverted index bitsets (O(1) lookups). Scripts must be executed for every single document that passes the initial filter, requiring expensive per-doc field loading and JVM execution cycles.
  3. C Scripts are required to travel to the Master node for validation before every execution.
  4. D Painless scripting is limited to only a single thread per cluster.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions