Class CrossProjectIndexExpressionsRewriter

java.lang.Object
org.elasticsearch.search.crossproject.CrossProjectIndexExpressionsRewriter

public class CrossProjectIndexExpressionsRewriter extends Object
Utility class for rewriting cross-project index expressions. Provides methods that can rewrite qualified and unqualified index expressions to canonical CCS.
  • Field Details

    • NO_MATCHING_PROJECT_EXCEPTION_VERSION

      public static TransportVersion 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 CCS
      originProjectAlias - 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 request
      projectRouting - the project routing that was applied to determine the origin and linked projects. null if no project routing was applied.
      Throws:
      InvalidIndexNameException - if exclusions are applied to both the project and the index expression
      NoMatchingProjectException - 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. Throws NoMatchingProjectException if a qualified resource cannot be resolved because a project is missing.