Class RoleBoolQueryBuilder

All Implemented Interfaces:
NamedWriteable, VersionedNamedWriteable, Writeable, QueryBuilder, Rewriteable<QueryBuilder>, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class RoleBoolQueryBuilder extends BoolQueryBuilder
  • Method Details

    • build

      public static RoleBoolQueryBuilder build(QueryBuilder queryBuilder, @Nullable Consumer<String> fieldNameVisitor)
      Build a bool query that is specialised for querying roles from the security index. The method processes the given QueryBuilder to ensure: * Only fields from an allowlist are queried * Only query types from an allowlist are used * Field names used in the Query DSL get translated into corresponding names used at the index level. * Not exposing any other types of documents stored in the same security index
      Parameters:
      queryBuilder - This represents the query parsed directly from the user input. It is validated and transformed (see above).
      fieldNameVisitor - This Consumer is invoked with all the (index-level) field names referred to in the passed-in query.
      Returns:
      A specialised query builder for roles that is safe to run on the security index.
    • doToQuery

      protected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws IOException
      Overrides:
      doToQuery in class BoolQueryBuilder
      Throws:
      IOException
    • doRewrite

      protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) throws IOException
      Overrides:
      doRewrite in class BoolQueryBuilder
      Throws:
      IOException