Class EsqlExecutionInfo
java.lang.Object
org.elasticsearch.xpack.esql.action.EsqlExecutionInfo
- All Implemented Interfaces:
Writeable,ChunkedToXContent,ChunkedToXContentObject
Holds execution metadata about ES|QL queries for cross-cluster searches in order to display
this information in ES|QL JSON responses.
Patterned after the SearchResponse.Clusters and SearchResponse.Cluster classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the search metadata about a particular cluster involved in a cross-cluster search.static enumNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.elasticsearch.xcontent.ParseFieldstatic final TransportVersionstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final Stringstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldFields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionEsqlExecutionInfo(boolean includeCCSMetadata) EsqlExecutionInfo(Predicate<String> skipOnPlanTimeFailurePredicate, EsqlExecutionInfo.IncludeExecutionMetadata includeExecutionMetadata) -
Method Summary
Modifier and TypeMethodDescriptionvoidclusterInfoInitializing(boolean clusterInfoInitializing) booleanvoidgetCluster(String clusterAlias) inthashCode()booleanIs there any metadata to report in the response? This is true on cross-cluster search with includeCCSMetadata=true or when there are partial failures.booleanvoidinitCluster(String clusterAlias, String indexExpression) This creates an initial Cluster object with indexExpression and skipUnavailable.booleanbooleanbooleanbooleanvoidvoidCall when ES|QL "planning" phase is complete and query execution (in ComputeService) is about to start.voidCall when ES|QL execution is complete in order to set the overall took time for an ES|QL query.org.elasticsearch.core.TimeValueorg.elasticsearch.core.TimeValuebooleanshouldSkipOnFailure(String clusterAlias) voidswapCluster(String clusterAlias, BiFunction<String, EsqlExecutionInfo.Cluster, EsqlExecutionInfo.Cluster> remappingFunction) Utility to swap a Cluster object.org.elasticsearch.core.TimeValueHow much time the query took since starting.toString()Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
toXContentChunked, toXContentChunkedV8Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContentObject
isFragment
-
Field Details
-
LOCAL_CLUSTER_NAME_REPRESENTATION
- See Also:
-
TOTAL_FIELD
public static final org.elasticsearch.xcontent.ParseField TOTAL_FIELD -
SUCCESSFUL_FIELD
public static final org.elasticsearch.xcontent.ParseField SUCCESSFUL_FIELD -
SKIPPED_FIELD
public static final org.elasticsearch.xcontent.ParseField SKIPPED_FIELD -
RUNNING_FIELD
public static final org.elasticsearch.xcontent.ParseField RUNNING_FIELD -
PARTIAL_FIELD
public static final org.elasticsearch.xcontent.ParseField PARTIAL_FIELD -
FAILED_FIELD
public static final org.elasticsearch.xcontent.ParseField FAILED_FIELD -
DETAILS_FIELD
public static final org.elasticsearch.xcontent.ParseField DETAILS_FIELD -
TOOK
public static final org.elasticsearch.xcontent.ParseField TOOK -
IS_PARTIAL_FIELD
public static final org.elasticsearch.xcontent.ParseField IS_PARTIAL_FIELD -
EXECUTION_METADATA_VERSION
-
clusterInfo
-
-
Constructor Details
-
EsqlExecutionInfo
public EsqlExecutionInfo(boolean includeCCSMetadata) -
EsqlExecutionInfo
public EsqlExecutionInfo(Predicate<String> skipOnPlanTimeFailurePredicate, EsqlExecutionInfo.IncludeExecutionMetadata includeExecutionMetadata) - Parameters:
skipOnPlanTimeFailurePredicate- Decides whether we should skip the cluster that fails during planning phase.includeExecutionMetadata- (user defined setting) whether to include the execution/CCS metadata in the HTTP response
-
EsqlExecutionInfo
- Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
includeCCSMetadata
public boolean includeCCSMetadata() -
includeExecutionMetadata
-
markEndPlanning
public void markEndPlanning()Call when ES|QL "planning" phase is complete and query execution (in ComputeService) is about to start. Note this is currently only built for a single phase planning/execution model. When INLINE STATS moves towards GA we may need to revisit this model. Currently, it should never be called more than once. -
planningTookTime
public org.elasticsearch.core.TimeValue planningTookTime() -
markEndQuery
public void markEndQuery()Call when ES|QL execution is complete in order to set the overall took time for an ES|QL query. -
overallTook
public org.elasticsearch.core.TimeValue overallTook() -
tookSoFar
public org.elasticsearch.core.TimeValue tookSoFar()How much time the query took since starting. -
overallTimeSpan
-
planningTimeSpan
-
clusterAliases
-
shouldSkipOnFailure
- Parameters:
clusterAlias- to check if we should skip this cluster on failure- Returns:
- whether it's OK to skip the cluster on failure.
- Throws:
NoSuchRemoteClusterException- if clusterAlias is unknown to this node's RemoteClusterService
-
isCrossClusterSearch
public boolean isCrossClusterSearch() -
hasMetadataToReport
public boolean hasMetadataToReport()Is there any metadata to report in the response? This is true on cross-cluster search with includeCCSMetadata=true or when there are partial failures. -
getCluster
-
getClusters
-
initCluster
This creates an initial Cluster object with indexExpression and skipUnavailable. -
swapCluster
public EsqlExecutionInfo.Cluster swapCluster(String clusterAlias, BiFunction<String, EsqlExecutionInfo.Cluster, EsqlExecutionInfo.Cluster> remappingFunction) Utility to swap a Cluster object. Guidelines for the remapping function:- The remapping function should return a new Cluster object to swap it for the existing one.
- If in the remapping function you decide to abort the swap you must return the original Cluster object to keep the map unchanged.
- Do not return
null. If the remapping function returnsnull, the mapping is removed (or remains absent if initially absent). - If the remapping function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged. Throwing exception therefore is OK, but it is generally discouraged.
- The remapping function may be called multiple times in a CAS fashion underneath, make sure that is safe to do so.
- Parameters:
clusterAlias- key with which the specified value is associatedremappingFunction- function to swap the oldCluster to a newCluster- Returns:
- the new Cluster object
-
toXContentChunked
public Iterator<? extends org.elasticsearch.xcontent.ToXContent> toXContentChunked(org.elasticsearch.xcontent.ToXContent.Params params) - Specified by:
toXContentChunkedin interfaceChunkedToXContent
-
getClusterStates
- Parameters:
status- the status you want to access- Returns:
- a stream of clusters with that status
-
getRunningClusterAliases
-
toString
-
equals
-
hashCode
public int hashCode() -
isPartial
public boolean isPartial() -
markAsStopped
public void markAsStopped() -
isStopped
public boolean isStopped() -
clusterInfoInitializing
public void clusterInfoInitializing(boolean clusterInfoInitializing) -
isMainPlan
public boolean isMainPlan() -
startSubPlans
public void startSubPlans() -
finishSubPlans
public void finishSubPlans()
-