public class IndexNameExpressionResolver extends AbstractComponent
deprecationLogger, logger, settings
Constructor and Description |
---|
IndexNameExpressionResolver(Settings settings) |
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
concreteIndexNames(ClusterState state,
IndicesOptions options,
java.lang.String... indexExpressions)
Translates the provided index expression into actual concrete indices, properly deduplicated.
|
java.lang.String[] |
concreteIndexNames(ClusterState state,
IndicesRequest request)
Same as
concreteIndexNames(ClusterState, IndicesOptions, String...) , but the index expressions and options
are encapsulated in the specified request. |
Index[] |
concreteIndices(ClusterState state,
IndicesOptions options,
long startTime,
java.lang.String... indexExpressions)
Translates the provided index expression into actual concrete indices, properly deduplicated.
|
Index[] |
concreteIndices(ClusterState state,
IndicesOptions options,
java.lang.String... indexExpressions)
Translates the provided index expression into actual concrete indices, properly deduplicated.
|
Index[] |
concreteIndices(ClusterState state,
IndicesRequest request)
Same as
concreteIndices(ClusterState, IndicesOptions, String...) , but the index expressions and options
are encapsulated in the specified request. |
Index |
concreteSingleIndex(ClusterState state,
IndicesRequest request)
Utility method that allows to resolve an index expression to its corresponding single concrete index.
|
java.lang.String[] |
filteringAliases(ClusterState state,
java.lang.String index,
java.lang.String... expressions)
Iterates through the list of indices and selects the effective list of filtering aliases for the
given index.
|
boolean |
hasIndexOrAlias(java.lang.String aliasOrIndex,
ClusterState state) |
java.lang.String[] |
indexAliases(ClusterState state,
java.lang.String index,
java.util.function.Predicate<AliasMetaData> requiredAlias,
boolean skipIdentity,
java.lang.String... expressions)
Iterates through the list of indices and selects the effective list of required aliases for the
given index.
|
static boolean |
isAllIndices(java.util.List<java.lang.String> aliasesOrIndices)
Identifies whether the array containing index names given as argument refers to all indices
The empty or null array identifies all indices
|
boolean |
matchesIndex(java.lang.String indexName,
java.lang.String expression,
ClusterState state)
Returns
true iff the given expression resolves to the given index name otherwise false |
java.lang.String |
resolveDateMathExpression(java.lang.String dateExpression) |
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
resolveSearchRouting(ClusterState state,
java.lang.String routing,
java.lang.String... expressions)
Resolves the search routing if in the expression aliases are used.
|
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
resolveSearchRoutingAllIndices(MetaData metaData,
java.lang.String routing)
Sets the same routing for all indices
|
logDeprecatedSetting, logRemovedSetting, nodeName
public IndexNameExpressionResolver(Settings settings)
public java.lang.String[] concreteIndexNames(ClusterState state, IndicesRequest request)
concreteIndexNames(ClusterState, IndicesOptions, String...)
, but the index expressions and options
are encapsulated in the specified request.public Index[] concreteIndices(ClusterState state, IndicesRequest request)
concreteIndices(ClusterState, IndicesOptions, String...)
, but the index expressions and options
are encapsulated in the specified request.public java.lang.String[] concreteIndexNames(ClusterState state, IndicesOptions options, java.lang.String... indexExpressions)
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.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.java.lang.IllegalArgumentException
- if one of the aliases resolve to multiple indices and the provided
indices options in the context don't allow such a case.public Index[] concreteIndices(ClusterState state, IndicesOptions options, java.lang.String... indexExpressions)
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.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.java.lang.IllegalArgumentException
- if one of the aliases resolve to multiple indices and the provided
indices options in the context don't allow such a case.public Index[] concreteIndices(ClusterState state, IndicesOptions options, long startTime, java.lang.String... indexExpressions)
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 indicesstartTime
- The start of the request where concrete indices is being invoked forindexExpressions
- expressions that can be resolved to alias or index names.java.lang.IllegalArgumentException
- if one of the aliases resolve to multiple indices and the provided
indices options in the context don't allow such a case.public Index concreteSingleIndex(ClusterState state, IndicesRequest request)
IndicesOptions
that require a single index as a result. The indices resolution must in fact return a single index when
using this method, an IllegalArgumentException
gets thrown otherwise.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.java.lang.IllegalArgumentException
- if the index resolution lead to more than one indexpublic boolean hasIndexOrAlias(java.lang.String aliasOrIndex, ClusterState state)
public java.lang.String resolveDateMathExpression(java.lang.String dateExpression)
public java.lang.String[] filteringAliases(ClusterState state, java.lang.String index, java.lang.String... expressions)
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.
public java.lang.String[] indexAliases(ClusterState state, java.lang.String index, java.util.function.Predicate<AliasMetaData> requiredAlias, boolean skipIdentity, java.lang.String... expressions)
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.
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resolveSearchRouting(ClusterState state, @Nullable java.lang.String routing, java.lang.String... expressions)
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> resolveSearchRoutingAllIndices(MetaData metaData, java.lang.String routing)
public static boolean isAllIndices(java.util.List<java.lang.String> aliasesOrIndices)
aliasesOrIndices
- the array containing index namespublic final boolean matchesIndex(java.lang.String indexName, java.lang.String expression, ClusterState state)
true
iff the given expression resolves to the given index name otherwise false