Class IndexNameExpressionResolver
org.elasticsearch.cluster.metadata.IndexNameExpressionResolver
public class IndexNameExpressionResolver
extends
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
This is a context for the DateMathExpressionResolver which does not requireIndicesOptions
orClusterState
since it uses only the start time to resolve expressions. -
Field Summary
-
Constructor Summary
ConstructorDescriptionIndexNameExpressionResolver(ThreadContext threadContext, SystemIndices systemIndices)
-
Method Summary
Modifier and TypeMethodDescription[]
concreteIndexNames(ClusterState state, IndicesRequest request)
Same asconcreteIndexNames(ClusterState, IndicesOptions, String...)
, but the index expressions and options are encapsulated in the specified request.[]
concreteIndexNames(ClusterState state, IndicesOptions options, boolean includeDataStreams, ... indexExpressions)
[]
concreteIndexNames(ClusterState state, IndicesOptions options, ... indexExpressions)
Translates the provided index expression into actual concrete indices, properly deduplicated.[]
concreteIndexNames(ClusterState state, IndicesOptions options, IndicesRequest request)
[]
concreteIndexNamesWithSystemIndexAccess(ClusterState state, IndicesRequest request)
Same asconcreteIndexNames(ClusterState, IndicesRequest)
, but access to system indices is always allowed.Index[]
concreteIndices(ClusterState state, IndicesRequest request)
Same asconcreteIndices(ClusterState, IndicesOptions, String...)
, but the index expressions and options are encapsulated in the specified request and resolves data streams.Index[]
concreteIndices(ClusterState state, IndicesRequest request, long startTime)
Translates the provided index expression into actual concrete indices, properly deduplicated.Index[]
concreteIndices(ClusterState state, IndicesOptions options, boolean includeDataStreams, ... indexExpressions)
Index[]
concreteIndices(ClusterState state, IndicesOptions options, ... indexExpressions)
Translates the provided index expression into actual concrete indices, properly deduplicated.concreteSingleIndex(ClusterState state, IndicesRequest request)
Utility method that allows to resolve an index expression to its corresponding single concrete index.concreteWriteIndex(ClusterState state, IndicesRequest request)
Utility method that allows to resolve an index expression to its corresponding single write index.concreteWriteIndex(ClusterState state, IndicesOptions options, index, boolean allowNoIndices, boolean includeDataStreams)
Utility method that allows to resolve an index expression to its corresponding single write index.<>
dataStreamNames(ClusterState state, IndicesOptions options, ... indexExpressions)
[]
filteringAliases(ClusterState state, index, <> resolvedExpressions)
Iterates through the list of indices and selects the effective list of filtering aliases for the given index.<>
<>
boolean
indexAbstraction, ClusterState state)
[]
indexAliases(ClusterState state, index, <AliasMetadata> requiredAlias, boolean skipIdentity, <> resolvedExpressions)
Iterates through the list of indices and selects the effective list of required aliases for the given index.static boolean
<> aliasesOrIndices)
Identifies whether the array containing index names given as argument refers to all indices The empty or null array identifies all indicesdateExpression)
dateExpression, long time)
<>
resolveExpressions(ClusterState state, ... expressions)
Resolve an array of expressions to the set of indices and aliases that these expressions match.<,<>>
resolveSearchRouting(ClusterState state, routing, ... expressions)
Resolves the search routing if in the expression aliases are used.<,<>>
resolveSearchRoutingAllIndices(Metadata metadata, routing)
Sets the same routing for all indicesMethods inherited from class java.lang.
, , , , , , , , , ,
-
Field Details
-
EXCLUDED_DATA_STREAMS_KEY
public static final EXCLUDED_DATA_STREAMS_KEY- See Also:
- Constant Field Values
-
SYSTEM_INDEX_ENFORCEMENT_VERSION
-
-
Constructor Details
-
IndexNameExpressionResolver
-
-
Method Details
-
concreteIndexNames
Same asconcreteIndexNames(ClusterState, IndicesOptions, String...)
, but the index expressions and options are encapsulated in the specified request. -
concreteIndexNamesWithSystemIndexAccess
Same asconcreteIndexNames(ClusterState, IndicesRequest)
, but access to system indices is always allowed. -
concreteIndices
Same asconcreteIndices(ClusterState, IndicesOptions, String...)
, but the index expressions and options are encapsulated in the specified request and resolves data streams. -
concreteIndexNames
Translates the provided index expression into actual concrete indices, properly deduplicated.- Parameters:
state
- the cluster state containing all the data to resolve to expressions to concrete indicesoptions
- defines how the aliases or indices need to be resolved to concrete indicesindexExpressions
- expressions that can be resolved to alias or index names.- Returns:
- the resolved concrete indices based on the cluster state, indices options and index expressions
- Throws:
IndexNotFoundException
- if one of the index expressions is pointing to a missing index or alias and the provided indices options in the context don't allow such a case, or if the final result of the indices resolution contains no indices and the indices options in the context don't allow such a case.- if one of the aliases resolve to multiple indices and the provided indices options in the context don't allow such a case.
-
concreteIndexNames
public [] concreteIndexNames(ClusterState state, IndicesOptions options, boolean includeDataStreams, ... indexExpressions) -
concreteIndexNames
-
dataStreamNames
-
concreteIndices
Translates the provided index expression into actual concrete indices, properly deduplicated.- Parameters:
state
- the cluster state containing all the data to resolve to expressions to concrete indicesoptions
- defines how the aliases or indices need to be resolved to concrete indicesindexExpressions
- expressions that can be resolved to alias or index names.- Returns:
- the resolved concrete indices based on the cluster state, indices options and index expressions
- Throws:
IndexNotFoundException
- if one of the index expressions is pointing to a missing index or alias and the provided indices options in the context don't allow such a case, or if the final result of the indices resolution contains no indices and the indices options in the context don't allow such a case.- if one of the aliases resolve to multiple indices and the provided indices options in the context don't allow such a case.
-
concreteIndices
public Index[] concreteIndices(ClusterState state, IndicesOptions options, boolean includeDataStreams, ... indexExpressions) -
concreteIndices
Translates the provided index expression into actual concrete indices, properly deduplicated.- Parameters:
state
- the cluster state containing all the data to resolve to expressions to concrete indicesstartTime
- The start of the request where concrete indices is being invoked forrequest
- request containing expressions that can be resolved to alias, index, or data stream names.- Returns:
- the resolved concrete indices based on the cluster state, indices options and index expressions provided indices options in the context don't allow such a case, or if the final result of the indices resolution contains no indices and the indices options in the context don't allow such a case.
- Throws:
- if one of the aliases resolve to multiple indices and the provided indices options in the context don't allow such a case.
-
concreteSingleIndex
Utility method that allows to resolve an index expression to its corresponding single concrete index. Callers should make sure they provide properIndicesOptions
that require a single index as a result. The indices resolution must in fact return a single index when using this method, an gets thrown otherwise.- Parameters:
state
- the cluster state containing all the data to resolve to expression to a concrete indexrequest
- The request that defines how the an alias or an index need to be resolved to a concrete index and the expression that can be resolved to an alias or an index name.- Returns:
- the concrete index obtained as a result of the index resolution
- Throws:
- if the index resolution lead to more than one index
-
concreteWriteIndex
Utility method that allows to resolve an index expression to its corresponding single write index.- Parameters:
state
- the cluster state containing all the data to resolve to expression to a concrete indexrequest
- The request that defines how the an alias or an index need to be resolved to a concrete index and the expression that can be resolved to an alias or an index name.- Returns:
- the write index obtained as a result of the index resolution
- Throws:
- if the index resolution does not lead to an index, or leads to more than one index
-
concreteWriteIndex
public Index concreteWriteIndex(ClusterState state, IndicesOptions options, index, boolean allowNoIndices, boolean includeDataStreams)Utility method that allows to resolve an index expression to its corresponding single write index.- Parameters:
state
- the cluster state containing all the data to resolve to expression to a concrete indexoptions
- defines how the aliases or indices need to be resolved to concrete indicesindex
- index that can be resolved to alias or index name.allowNoIndices
- whether to allow resolve to no indexincludeDataStreams
- Whether data streams should be included in the evaluation.- Returns:
- the write index obtained as a result of the index resolution or null if no index
- Throws:
- if the index resolution does not lead to an index, or leads to more than one index
-
hasIndexAbstraction
- Returns:
- whether the specified index, data stream or alias exists. If the data stream, index or alias contains date math then that is resolved too.
-
resolveDateMathExpression
public resolveDateMathExpression( dateExpression)- Returns:
- If the specified string is data math expression then this method returns the resolved expression.
-
resolveDateMathExpression
public resolveDateMathExpression( dateExpression, long time)- Parameters:
time
- instant to consider when parsing the expression- Returns:
- If the specified string is data math expression then this method returns the resolved expression.
-
resolveExpressions
Resolve an array of expressions to the set of indices and aliases that these expressions match. -
filteringAliases
Iterates through the list of indices and selects the effective list of filtering aliases for the given index.Only aliases with filters are returned. If the indices list contains a non-filtering reference to the index itself - null is returned. Returns
null
if no filtering is required. NOTE: The provided expressions must have been resolved already viaresolveExpressions(org.elasticsearch.cluster.ClusterState, java.lang.String...)
. -
indexAliases
public [] indexAliases(ClusterState state, index, <AliasMetadata> requiredAlias, boolean skipIdentity, <> resolvedExpressions)Iterates through the list of indices and selects the effective list of required aliases for the given index.Only aliases where the given predicate tests successfully are returned. If the indices list contains a non-required reference to the index itself - null is returned. Returns
null
if no filtering is required.NOTE: the provided expressions must have been resolved already via
resolveExpressions(org.elasticsearch.cluster.ClusterState, java.lang.String...)
. -
resolveSearchRouting
Resolves the search routing if in the expression aliases are used. If expressions point to concrete indices or aliases with no routing defined the specified routing is used.- Returns:
- routing values grouped by concrete index
-
resolveSearchRoutingAllIndices
Sets the same routing for all indices -
isAllIndices
public static boolean isAllIndices(<> aliasesOrIndices)Identifies whether the array containing index names given as argument refers to all indices The empty or null array identifies all indices- Parameters:
aliasesOrIndices
- the array containing index names- Returns:
- true if the provided array maps to all indices, false otherwise
-
getSystemIndexAccessLevel
-
getSystemIndexAccessPredicate
public <> getSystemIndexAccessPredicate() -
getNetNewSystemIndexPredicate
public <> getNetNewSystemIndexPredicate()
-