Module org.elasticsearch.server
Class CrossProjectIndexExpressionsRewriter
java.lang.Object
org.elasticsearch.search.crossproject.CrossProjectIndexExpressionsRewriter
Utility class for rewriting cross-project index expressions.
Provides methods that can rewrite qualified and unqualified index expressions to canonical CCS.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA container for a local expression and a list of remote expressions. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionrewriteIndexExpression(String indexExpression, String originProjectAlias, Set<String> allProjectAliases, String projectRouting) Rewrites an index expression for cross-project search requests.static voidvalidateIndexExpressionWithoutRewrite(String indexExpression, String originProjectAlias, Set<String> allProjectAliases, String projectRouting) Validates whether the index expression refers to an existing project without rewriting or expanding indices.
-
Field Details
-
NO_MATCHING_PROJECT_EXCEPTION_VERSION
-
EXCLUSION_PREFIX
public static final char EXCLUSION_PREFIX- See Also:
-
-
Constructor Details
-
CrossProjectIndexExpressionsRewriter
public CrossProjectIndexExpressionsRewriter()
-
-
Method Details
-
rewriteIndexExpression
public static CrossProjectIndexExpressionsRewriter.IndexRewriteResult rewriteIndexExpression(String indexExpression, @Nullable String originProjectAlias, Set<String> allProjectAliases, @Nullable String projectRouting) Rewrites an index expression for cross-project search requests.- Parameters:
indexExpression- the index expression to be rewritten to canonical CCSoriginProjectAlias- the alias of the origin project (can be null if it was excluded by project routing). It's passed additionally to allProjectAliases because the origin project requires special handling: it can match on its actual alias and on the special alias "_origin". Any expression matched by the origin project also cannot be qualified with its actual alias in the final rewritten expression.allProjectAliases- the list of all project aliases (linked and origin) consider for a requestprojectRouting- the project routing that was applied to determine the origin and linked projects.nullif no project routing was applied.- Throws:
InvalidIndexNameException- if exclusions are applied to both the project and the index expressionNoMatchingProjectException- if a qualified resource cannot be resolved because a project is missing
-
validateIndexExpressionWithoutRewrite
public static void validateIndexExpressionWithoutRewrite(String indexExpression, @Nullable String originProjectAlias, Set<String> allProjectAliases, @Nullable String projectRouting) Validates whether the index expression refers to an existing project without rewriting or expanding indices. ThrowsNoMatchingProjectExceptionif a qualified resource cannot be resolved because a project is missing.
-