Interface TranslationAware
- All Known Subinterfaces:
TranslationAware.SingleValueTranslationAware
- All Known Implementing Classes:
And,BinaryLogic,CIDRMatch,EndsWith,Equals,EsqlBinaryComparison,FullTextFunction,GreaterThan,GreaterThanOrEqual,In,InsensitiveBinaryComparison,InsensitiveEquals,IsNotNull,IsNull,Knn,Kql,LessThan,LessThanOrEqual,Match,MatchOperator,MatchPhrase,MultiMatch,Not,NotEquals,Or,QueryString,Range,RLike,RLikeList,SpatialContains,SpatialDisjoint,SpatialIntersects,SpatialRelatesFunction,SpatialWithin,StartsWith,Term,WildcardLike,WildcardLikeList
public interface TranslationAware
Expressions implementing this interface are asked provide an
Elasticsearch/Lucene query as part of the data node optimizations.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic interfaceSubinterface for expressions that can only process single values (and null out on MVs).static enumHow is this expression translatable? -
Method Summary
Modifier and TypeMethodDescriptiondefault org.apache.lucene.search.QueryasLuceneQuery(MappedFieldType fieldType, org.apache.lucene.search.MultiTermQuery.RewriteMethod constantScoreRewrite, SearchExecutionContext context) Translates this expression into a LuceneQuery.asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHandler handler) Translates the implementing expression into a Query.translatable(Expression exp, LucenePushdownPredicates lucenePushdownPredicates) Is anExpressiontranslatable?translatable(LucenePushdownPredicates pushdownPredicates) Can this instance be translated or not? Usually checks whether the expression arguments are actual fields that exist in Lucene.
-
Method Details
-
translatable
Can this instance be translated or not? Usually checks whether the expression arguments are actual fields that exist in Lucene. SeeTranslationAware.Translatablefor precisely what can be signaled from this method. -
translatable
static TranslationAware.Translatable translatable(Expression exp, LucenePushdownPredicates lucenePushdownPredicates) Is anExpressiontranslatable? -
asQuery
Translates the implementing expression into a Query. If during translation a child needs to be translated first, the handler needs to be used even if the child implements this interface as well. This is to ensure that the child is wrapped in a SingleValueQuery if necessary.So use this:
Query childQuery = handler.asQuery(child);and not this:
Query childQuery = child.asQuery(handler); -
asLuceneQuery
default org.apache.lucene.search.Query asLuceneQuery(MappedFieldType fieldType, org.apache.lucene.search.MultiTermQuery.RewriteMethod constantScoreRewrite, SearchExecutionContext context) Translates this expression into a LuceneQuery.Implementations should use the provided field type, rewrite method, and search execution context to construct an appropriate Lucene query for this expression. By default, this method throws
UnsupportedOperationException; override it in subclasses that support Lucene query translation.
-