elastic / elasticsearch

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

Add ingest processor to percolator that rewrites queries #29053

Open martijnvg opened 6 years ago

martijnvg commented 6 years ago

Follow up from #17071

The percolator needs a ingest processor that performs the QueryBuilder rewrite. At the moment the query builder rewrite happens in the PercolatorFieldMapper which means each shard copy performs this rewrite. Most of the time this isn't a problem, but in the case that a query builder does a remote fetch (geo_shape query using indexed shape) there is a chance that the query builder rewrite that each shard copy forms fetch slightly different values.

elasticmachine commented 6 years ago

Pinging @elastic/es-search-aggs

colings86 commented 6 years ago

When we implement this we should add a check in PercolatorFieldMapper that checks the query does not contain any async actions that have not been performed. We do this with search already and it outputs and error with async actions are left after rewrite if there are any fetches that have not been completed when the rewrite is finished.

Having this check will make sure that users who forget to use the ingest processor are notified rather than the query being silently accepted.

colings86 commented 6 years ago

We can do the above mentioned check be still performing the rewrite in PercolatorFieldMapper as we do now but calling Rewritable.rewrite(T original, QueryRewriteContext context, boolean assertNoAsyncTasks) with assertNoAsyncTasks set to true

elasticsearchmachine commented 2 months ago

Pinging @elastic/es-search-relevance (Team:Search Relevance)