Class EnrichPolicyResolver
java.lang.Object
org.elasticsearch.xpack.esql.enrich.EnrichPolicyResolver
Resolves enrich policies across clusters in several steps:
1. Calculates the policies that need to be resolved for each cluster, see
lookupPolicies(java.util.Collection<java.lang.String>, boolean, java.util.Collection<org.elasticsearch.xpack.esql.enrich.EnrichPolicyResolver.UnresolvedPolicy>, org.elasticsearch.xpack.esql.action.EsqlExecutionInfo, org.elasticsearch.TransportVersion, org.elasticsearch.action.ActionListener<java.util.Map<java.lang.String, org.elasticsearch.xpack.esql.enrich.EnrichPolicyResolver.LookupResponse>>).
2. Sends out EnrichPolicyResolver.LookupRequest to each cluster to resolve policies. Internally, a remote cluster handles the lookup in two steps:
- 2.1 Ensures the caller has permission to access the enrich policies.
- 2.2 For each found enrich policy, uses IndexResolver to resolve the mappings of the concrete enrich index.
3. For each unresolved policy, combines the lookup results to compute the actual enrich policy and mappings depending on the enrich mode.
This approach requires at most one cross-cluster call for each cluster.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEnrichPolicyResolver(ClusterService clusterService, TransportService transportService, IndexResolver indexResolver, ProjectResolver projectResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String, EnrichPolicy> protected voiddoResolvePolicies(Set<String> remoteClusters, Collection<EnrichPolicyResolver.UnresolvedPolicy> unresolvedPolicies, EsqlExecutionInfo executionInfo, TransportVersion minimumVersion, ActionListener<EnrichResolution> listener) protected voidgetRemoteConnection(String cluster, boolean ensureConnected, ActionListener<Transport.Connection> listener) voidresolvePolicies(List<Enrich> enriches, EsqlExecutionInfo executionInfo, TransportVersion minimumVersion, ActionListener<EnrichResolution> listener) Resolves a set of enrich policies
-
Field Details
-
ESQL_USE_MINIMUM_VERSION_FOR_ENRICH_RESOLUTION
-
-
Constructor Details
-
EnrichPolicyResolver
public EnrichPolicyResolver(ClusterService clusterService, TransportService transportService, IndexResolver indexResolver, ProjectResolver projectResolver)
-
-
Method Details
-
resolvePolicies
public void resolvePolicies(List<Enrich> enriches, EsqlExecutionInfo executionInfo, TransportVersion minimumVersion, ActionListener<EnrichResolution> listener) Resolves a set of enrich policies- Parameters:
enriches- the unresolved policiesexecutionInfo- the execution infominimumVersion- the minimum transport version of all clusters involved in the query; used for making the resolved mapping compatible with all involved clusters in case of CCS. (Enrich policy resolution happens separately on each remote cluster.)listener- notified with the enrich resolution
-
doResolvePolicies
protected void doResolvePolicies(Set<String> remoteClusters, Collection<EnrichPolicyResolver.UnresolvedPolicy> unresolvedPolicies, EsqlExecutionInfo executionInfo, TransportVersion minimumVersion, ActionListener<EnrichResolution> listener) -
availablePolicies
-
getRemoteConnection
protected void getRemoteConnection(String cluster, boolean ensureConnected, ActionListener<Transport.Connection> listener)
-