elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
68.75k stars 24.42k forks source link

ESQL: reorder filter expressions based on evaluation cost #109786

Open costin opened 1 month ago

costin commented 1 month ago

Sometimes filters declare expensive expressions first followed by the cheap expressions at the end. Where possible we should optimize these by moving the expressions at the head, forcing their early evaluation (and selectivity):

where my_function(field) AND field != null
// should become
where field != null && my_function(field)
elasticsearchmachine commented 1 month ago

Pinging @elastic/es-analytical-engine (Team:Analytics)