Class AbstractLookupService<R extends org.elasticsearch.xpack.esql.enrich.AbstractLookupService.Request,T extends org.elasticsearch.xpack.esql.enrich.AbstractLookupService.TransportRequest>

java.lang.Object
org.elasticsearch.xpack.esql.enrich.AbstractLookupService<R,T>
Direct Known Subclasses:
EnrichLookupService, LookupFromIndexService

public abstract class AbstractLookupService<R extends org.elasticsearch.xpack.esql.enrich.AbstractLookupService.Request,T extends org.elasticsearch.xpack.esql.enrich.AbstractLookupService.TransportRequest> extends Object
AbstractLookupService performs a LEFT JOIN for a given input page against another index that must have only a single shard.

This registers a TransportRequestHandler so we can handle requests to join data that isn't local to the node, but it is much faster if the data is already local.

The join process spawns a Driver per incoming page which runs in two or three stages:

Stage 1: Finding matching document IDs for the input page. This stage is done by the EnrichQuerySourceOperator. The output page of this stage is represented as [DocVector, IntBlock: positions of the input terms].

Stage 2: Extracting field values for the matched document IDs. The output page is represented as [DocVector, IntBlock: positions, Block: field1, Block: field2,...].

Stage 3: Optionally this combines the extracted values based on positions and filling nulls for positions without matches. This is done by MergePositionsOperator. The output page is represented as [Block: field1, Block: field2,...].

The Page.getPositionCount() of the output Page is equal to the Page.getPositionCount() of the input page. In other words - it returns the same number of rows that it was sent no matter how many documents match.