Class SingleValueQuery
java.lang.Object
org.elasticsearch.xpack.esql.core.querydsl.query.Query
org.elasticsearch.xpack.esql.querydsl.query.SingleValueQuery
Lucene query that wraps another query and only selects documents that match
the wrapped query and have a single field value.
This allows us to wrap regular lucene queries to have ESQL style semantics which will allow us to continue to push expressions to Lucene.
We could have chosen not to wrap the lucene query and instead double check the results after they are loaded. That could be faster in some cases, but for now we're going to always wrap so we can always push. When we find cases where double checking is better we'll try that.
NOTE: This will only work with text fields.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classBuilds aboolquery combining the "next" query and aSingleValueMatchQuery.static classBuilds a query matching either ignored values OR the union ofnextquery andSingleValueMatchQuery.static classBuilds aboolquery ANDing the "next" query, aSingleValueMatchQuery, and aTermQuerymaking sure we didn't ignore any values.static enum -
Field Summary
FieldsFields inherited from class org.elasticsearch.xpack.esql.core.querydsl.query.Query
NO_SCORE_BOOST -
Constructor Summary
ConstructorsConstructorDescriptionSingleValueQuery(Query next, String field, boolean useSyntheticSourceDelegate) Build.SingleValueQuery(Query next, String field, SingleValueQuery.UseSyntheticSourceDelegate useSyntheticSourceDelegate) -
Method Summary
Modifier and TypeMethodDescriptionprotected SingleValueQuery.AbstractBuilderUsed internally to convert to retrieve aQueryBuilderby queries.booleanDoes the result of callingQuery.asBuilder()need the plan to serialize itself?booleaninthashCode()protected StringUsed byQuery.toString()to produce a pretty string.Negate this query, returning a query that includes documents that would returnfalsewhen running the represented operation.
-
Field Details
-
ENTRY
-
-
Constructor Details
-
SingleValueQuery
Build.- Parameters:
next- the query whose documents we should use for single-valued fieldsfield- the name of the field whose values to checkuseSyntheticSourceDelegate- Should we check the field's synthetic source delegate (true) or it's values itself? If the field is atextfield we often want to use its delegate.
-
SingleValueQuery
public SingleValueQuery(Query next, String field, SingleValueQuery.UseSyntheticSourceDelegate useSyntheticSourceDelegate)
-
-
Method Details
-
asBuilder
Description copied from class:QueryUsed internally to convert to retrieve aQueryBuilderby queries. -
innerToString
Description copied from class:QueryUsed byQuery.toString()to produce a pretty string.- Specified by:
innerToStringin classQuery
-
negate
Description copied from class:QueryNegate this query, returning a query that includes documents that would returnfalsewhen running the represented operation. The default implementation just returns aNotQuerywrappingthisbecause most queries don't model underlying operations that can returnnull. Queries that model expressions that can returnnullmust make sure all documents that would returnnullare still excluded from the match. -
equals
-
hashCode
public int hashCode() -
containsPlan
public boolean containsPlan()Description copied from class:QueryDoes the result of callingQuery.asBuilder()need the plan to serialize itself?- Specified by:
containsPlanin classQuery
-