elastic / elasticsearch

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

Create a percolator-specific PercolatorExecutionContext #96447

Open salvatore-campagna opened 1 year ago

salvatore-campagna commented 1 year ago

Description

Right now the QueryRewriteContext includes two member fields allowUnmappedFields and mapUnmappedFieldAsString with their setters, which control the behaviour of the percolator through PercolatorFieldMapper and PercolateQueryBuilder. We can extract those member fields and a few methods like getFieldType and failIfFieldMappingNotFound in a subclass of QueryRewriteContext (PercolatorExecutionContext) which encapsulates the percolator-specific behaviour and create a new instance of that class by wrapping the original QueryRewriteContext (see PercolatorFieldMapper#configureContext).

We can also move the new PercolatorExecutionContext to the percolator module.

NOTE: pay attention to BWC since the percolator stores the percolator query in an index and serialisation might break.

This is a followup of #96353

elasticsearchmachine commented 1 year ago

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

elasticsearchmachine commented 2 months ago

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