Module org.elasticsearch.security
Class RoleBoolQueryBuilder
java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<BoolQueryBuilder>
org.elasticsearch.index.query.BoolQueryBuilder
org.elasticsearch.xpack.security.support.RoleBoolQueryBuilder
- All Implemented Interfaces:
NamedWriteable,VersionedNamedWriteable,Writeable,QueryBuilder,Rewriteable<QueryBuilder>,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from class org.elasticsearch.index.query.BoolQueryBuilder
ADJUST_PURE_NEGATIVE_DEFAULT, NAMEFields inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryNameFields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDSFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionstatic RoleBoolQueryBuilderbuild(QueryBuilder queryBuilder, Consumer<String> fieldNameVisitor) Build a bool query that is specialised for querying roles from the security index.protected QueryBuilderdoRewrite(QueryRewriteContext queryRewriteContext) protected org.apache.lucene.search.QuerydoToQuery(SearchExecutionContext context) Methods inherited from class org.elasticsearch.index.query.BoolQueryBuilder
adjustPureNegative, adjustPureNegative, doEquals, doHashCode, doWriteTo, doXContent, extractInnerHitBuilders, filter, filter, fromXContent, getMinimalSupportedVersion, getWriteableName, hasClauses, minimumShouldMatch, minimumShouldMatch, minimumShouldMatch, must, must, mustNot, mustNot, shallowCopy, should, shouldMethods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, boostAndQueryNameToXContent, checkNegativeBoost, declareStandardFields, doCoordinatorRewrite, doIndexMetadataRewrite, doInnerHitsRewrite, doSearchRewrite, equals, getMaxNestedDepth, getName, hashCode, parseInnerQueryBuilder, parseTopLevelQuery, parseTopLevelQuery, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, setMaxNestedDepth, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeQueries, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
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- ThisConsumeris 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:
doToQueryin classBoolQueryBuilder- Throws:
IOException
-
doRewrite
- Overrides:
doRewritein classBoolQueryBuilder- Throws:
IOException
-