Class LookupFromIndexService
java.lang.Object
org.elasticsearch.xpack.esql.enrich.AbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
org.elasticsearch.xpack.esql.enrich.LookupFromIndexService
public class LookupFromIndexService
extends AbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
LookupFromIndexService performs lookup against a Lookup index for
a given input page. See AbstractLookupService for how it works
where it refers to this process as a LEFT JOIN. Which is mostly is.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classstatic classNested classes/interfaces inherited from class org.elasticsearch.xpack.esql.enrich.AbstractLookupService
AbstractLookupService.LookupShardContext, AbstractLookupService.LookupShardContextFactory -
Field Summary
FieldsFields inherited from class org.elasticsearch.xpack.esql.enrich.AbstractLookupService
bigArrays, blockFactory, clusterService, executor, indicesService, localBreakerSettings, LOOKUP_POSITIONS_FIELD, lookupShardContextFactory, mergePages, plannerSettings, projectResolver, transportService -
Constructor Summary
ConstructorsConstructorDescriptionLookupFromIndexService(ClusterService clusterService, IndicesService indicesService, AbstractLookupService.LookupShardContextFactory lookupShardContextFactory, TransportService transportService, IndexNameExpressionResolver indexNameExpressionResolver, BigArrays bigArrays, BlockFactory blockFactory, ProjectResolver projectResolver, PlannerSettings.Holder plannerSettings, ExchangeService exchangeService) -
Method Summary
Modifier and TypeMethodDescriptionstatic LogicalPlanbuildLocalLogicalPlan(Source source, List<MatchConfig> matchFields, Expression joinOnConditions, PhysicalPlan rightPreJoinPlan, List<NamedExpression> extractFields) Builds a logical plan for the lookup node from the request.static PhysicalPlancreateLookupPhysicalPlan(LogicalPlan logicalPlan, Configuration configuration, PlannerSettings plannerSettings, FoldContext foldCtx, SearchStats searchStats, EsqlFlags flags) Builds the physical plan for the lookup node by running: LookupLogicalOptimizer -> LocalMapper.map -> LookupPhysicalPlanOptimizer.protected LookupFromIndexService.LookupResponsecreateLookupResponse(List<Page> pages, BlockFactory blockFactory) Build the response.protected DiscoveryNodeprotected voiddoLookup(LookupFromIndexService.LookupRequest request, CancellableTask task, ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse> listener) protected voiddoLookupStreaming(LookupFromIndexService.LookupRequest request, CancellableTask task, ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse> listener) protected LookupEnrichQueryGeneratorqueryList(LookupFromIndexService.LookupRequest request, SearchExecutionContext context, AliasFilter aliasFilter, Warnings warnings) Build a list of queries to perform inside the actual lookup.protected LookupEnrichQueryGeneratorqueryListFromPlan(List<MatchConfig> matchFields, Expression joinOnConditions, QueryBuilder pushedQuery, SearchExecutionContext context, AliasFilter aliasFilter, Warnings warnings) Builds a query list for the streaming lookup path using data from the physical plan tree rather than from the transport request.protected org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponsereadLookupResponse(StreamInput in, BlockFactory blockFactory) Read the response from aStreamInput.protected voidstartServerWithOperators(BidirectionalBatchExchangeServer server, org.elasticsearch.xpack.esql.enrich.LookupFromIndexService.LookupQueryPlan lookupQueryPlan, List<Operator> intermediateOperators, org.elasticsearch.core.Releasable releasables, ActionListener<? super LookupFromIndexService.LookupResponse> responseListener, String planString) Starts the exchange server with the generated operators.protected LookupFromIndexService.LookupRequesttransportRequest(LookupFromIndexService.Request request, ShardId shardId) Convert a request as sent toAbstractLookupService.lookupAsync(R, org.elasticsearch.tasks.CancellableTask, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse>)into a transport request after preflight checks have been performed.Methods inherited from class org.elasticsearch.xpack.esql.enrich.AbstractLookupService
createNullResponse, extractFieldName, getBreaker, getExecutor, getThreadContext, lookupAsync, lookupAsync, respondWithPages, sendChildRequest, termQueryList
-
Field Details
-
LOOKUP_ACTION_NAME
- See Also:
-
exchangeService
-
-
Constructor Details
-
LookupFromIndexService
public LookupFromIndexService(ClusterService clusterService, IndicesService indicesService, AbstractLookupService.LookupShardContextFactory lookupShardContextFactory, TransportService transportService, IndexNameExpressionResolver indexNameExpressionResolver, BigArrays bigArrays, BlockFactory blockFactory, ProjectResolver projectResolver, PlannerSettings.Holder plannerSettings, ExchangeService exchangeService)
-
-
Method Details
-
getExchangeService
-
getClusterService
-
getSettings
-
getTransportService
-
getProjectResolver
-
transportRequest
protected LookupFromIndexService.LookupRequest transportRequest(LookupFromIndexService.Request request, ShardId shardId) Description copied from class:AbstractLookupServiceConvert a request as sent toAbstractLookupService.lookupAsync(R, org.elasticsearch.tasks.CancellableTask, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse>)into a transport request after preflight checks have been performed.- Specified by:
transportRequestin classAbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
-
queryList
protected LookupEnrichQueryGenerator queryList(LookupFromIndexService.LookupRequest request, SearchExecutionContext context, AliasFilter aliasFilter, Warnings warnings) Description copied from class:AbstractLookupServiceBuild a list of queries to perform inside the actual lookup.- Specified by:
queryListin classAbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
-
queryListFromPlan
protected LookupEnrichQueryGenerator queryListFromPlan(List<MatchConfig> matchFields, @Nullable Expression joinOnConditions, @Nullable QueryBuilder pushedQuery, SearchExecutionContext context, AliasFilter aliasFilter, Warnings warnings) Builds a query list for the streaming lookup path using data from the physical plan tree rather than from the transport request. -
createLookupResponse
protected LookupFromIndexService.LookupResponse createLookupResponse(List<Page> pages, BlockFactory blockFactory) Description copied from class:AbstractLookupServiceBuild the response.- Specified by:
createLookupResponsein classAbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
-
readLookupResponse
protected org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse readLookupResponse(StreamInput in, BlockFactory blockFactory) throws IOException Description copied from class:AbstractLookupServiceRead the response from aStreamInput.- Specified by:
readLookupResponsein classAbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest> - Throws:
IOException
-
doLookup
protected void doLookup(LookupFromIndexService.LookupRequest request, CancellableTask task, ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse> listener) - Overrides:
doLookupin classAbstractLookupService<LookupFromIndexService.Request,LookupFromIndexService.LookupRequest>
-
doLookupStreaming
protected void doLookupStreaming(LookupFromIndexService.LookupRequest request, CancellableTask task, ActionListener<org.elasticsearch.xpack.esql.enrich.AbstractLookupService.LookupResponse> listener) -
determineClientNode
protected DiscoveryNode determineClientNode(LookupFromIndexService.LookupRequest request, CancellableTask task) -
startServerWithOperators
protected void startServerWithOperators(BidirectionalBatchExchangeServer server, org.elasticsearch.xpack.esql.enrich.LookupFromIndexService.LookupQueryPlan lookupQueryPlan, List<Operator> intermediateOperators, org.elasticsearch.core.Releasable releasables, ActionListener<? super LookupFromIndexService.LookupResponse> responseListener, @Nullable String planString) Starts the exchange server with the generated operators. This method can be overridden in tests to capture the plan without actually starting the server. -
buildLocalLogicalPlan
public static LogicalPlan buildLocalLogicalPlan(Source source, List<MatchConfig> matchFields, @Nullable Expression joinOnConditions, @Nullable PhysicalPlan rightPreJoinPlan, List<NamedExpression> extractFields) Builds a logical plan for the lookup node from the request. Walks the logical plan tree insiderightPreJoinPlan, preserving all nodes (Filter, etc.), and replaces theEsRelationleaf with aParameterizedQuery. Then adds aProjecton top for [_positions,extractFields]. -
createLookupPhysicalPlan
public static PhysicalPlan createLookupPhysicalPlan(LogicalPlan logicalPlan, @Nullable Configuration configuration, PlannerSettings plannerSettings, FoldContext foldCtx, SearchStats searchStats, EsqlFlags flags) Builds the physical plan for the lookup node by running: LookupLogicalOptimizer -> LocalMapper.map -> LookupPhysicalPlanOptimizer. The caller is responsible for building the logical plan viabuildLocalLogicalPlan(org.elasticsearch.xpack.esql.core.tree.Source, java.util.List<org.elasticsearch.xpack.esql.enrich.MatchConfig>, org.elasticsearch.xpack.esql.core.expression.Expression, org.elasticsearch.xpack.esql.plan.physical.PhysicalPlan, java.util.List<org.elasticsearch.xpack.esql.core.expression.NamedExpression>).
-