Class DatasetResolver

java.lang.Object
org.elasticsearch.xpack.esql.datasources.DatasetResolver

public class DatasetResolver extends Object
Owns the security round-trip for FROM <dataset>, the companion of DatasetRewriter: each FROM relation the query reads is dispatched — one EsqlResolveDatasetAction per relation, with that relation's RAW patterns — so the authorization engine read-authorizes the names (index read privilege) and rejects DLS/FLS-restricted datasets, then narrows wildcard expansion to the authorized abstractions. The per-relation results feed a synchronous DatasetRewriter.rewrite(org.elasticsearch.xpack.esql.plan.logical.LogicalPlan, org.elasticsearch.cluster.metadata.ProjectMetadata, java.util.Map<org.elasticsearch.xpack.esql.plan.logical.UnresolvedRelation, org.elasticsearch.xpack.esql.datasources.DatasetRewriter.DatasetResolution>, boolean) that turns authorized datasets into external relations.

Per-relation dispatch (rather than one request for the whole plan) is required because exclusion semantics are per-relation: -logs_test in one FROM must not drop logs_test from a different FROM in the same plan. Mirrors how ViewResolver routes each UnresolvedRelation's raw patterns through EsqlResolveViewAction.

When no dataset is registered in cluster state, or no FROM pattern can match a registered dataset, the listener completes synchronously and no request is sent.

  • Constructor Details

  • Method Details

    • replaceDatasets

      public void replaceDatasets(LogicalPlan parsed, ProjectMetadata projectMetadata, ActionListener<LogicalPlan> listener)
      Completes listener with the rewritten plan (or the untouched plan when no relation qualifies). Authorization failures (DLS/FLS, and the Unknown index a rewrite raises for an explicit unauthorized dataset) propagate as-is.