Package org.nuxeo.elasticsearch.query
Class NxQueryBuilder
java.lang.Object
org.nuxeo.elasticsearch.query.NxQueryBuilder
Elasticsearch query builder for the Nuxeo ES api.
- Since:
- 5.9.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected final List<AggregateEsBase<org.opensearch.search.aggregations.Aggregation,Bucket>> protected static final intprotected booleanprotected org.opensearch.index.query.QueryBuilderprotected booleanprotected EsFetcher.HitDocConsumerprotected intprotected Stringprotected intprotected booleanprotected booleanprotected String[]protected final CoreSessionprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAggregate(AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation, ? extends Bucket> aggregate) addAggregates(List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation, ? extends Bucket>> aggregates) addSearchRepository(String repositoryName) Add a specific repository to search.protected org.opensearch.index.query.QueryBuilderaddSecurityFilter(org.opensearch.index.query.QueryBuilder query) esQuery(org.opensearch.index.query.QueryBuilder queryBuilder) Build the query using the Elasticsearch QueryBuilder API.Fetch the documents using VCS (database) engine.Ask for the Elasticsearch _source field, use it to build documents.protected org.opensearch.index.query.QueryBuilderprotected org.opensearch.index.query.QueryBuilderstatic StringgetAggregateFilterId(Aggregate<?> agg) List<AggregateEsBase<org.opensearch.search.aggregations.Aggregation,Bucket>> List<org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder>protected FetchergetFetcher(CoreSession session, org.opensearch.action.search.SearchResponse response, Map<String, String> repoNames) getFetcher(org.opensearch.action.search.SearchResponse response, Map<String, String> repoNames) intgetLimit()getNxql()intReturn the list of repositories to search, or an empty list to search on all available repositories;String[]org.opensearch.search.sort.SortBuilder<?>[]protected StringguessFieldType(String field) hitDocConsumer(EsFetcher.HitDocConsumer consumer) If search results are found, use this SearchHit and DocumentModel consumer on each hit.booleanlimit(int limit) No more than that many documents will be returned.org.opensearch.index.query.QueryBuilderGet the Elasticsearch queryBuilder.Build the query from a NXQL string.protected booleannxqlHasSelectClause(String nxql) offset(int offset) Says to skip that many documents before beginning to return documents.Don't return document model list, aggregates or rows, only the original Elasticsearch response is accessible fromEsResult.getElasticsearchResponse()booleanbooleanSearch on all available repositories.voidupdateRequest(org.opensearch.search.builder.SearchSourceBuilder request) useUnrestrictedSession(boolean useUnrestrictedSession)
-
Field Details
-
DEFAULT_LIMIT
protected static final int DEFAULT_LIMIT- See Also:
-
AGG_FILTER_SUFFIX
- See Also:
-
session
-
sortInfos
-
repositories
-
aggregates
protected final List<AggregateEsBase<org.opensearch.search.aggregations.Aggregation,Bucket>> aggregates -
limit
protected int limit -
offset
protected int offset -
nxql
-
esQueryBuilder
protected org.opensearch.index.query.QueryBuilder esQueryBuilder -
fetchFromElasticsearch
protected boolean fetchFromElasticsearch -
searchOnAllRepo
protected boolean searchOnAllRepo -
selectFields
-
selectFieldsAndTypes
-
returnsDocuments
protected boolean returnsDocuments -
esOnly
protected boolean esOnly -
highlightFields
-
hitDocConsumer
-
useUnrestrictedSession
protected boolean useUnrestrictedSession
-
-
Constructor Details
-
NxQueryBuilder
-
-
Method Details
-
getAggregateFilterId
-
limit
No more than that many documents will be returned. Default to {DEFAULT_LIMIT}. This settings could be changed on ES by changing {index.max_result_window}, but it is preferable to use the scan & scroll API. -
offset
Says to skip that many documents before beginning to return documents. If both offset and limit appear, then offset documents are skipped before starting to count the limit documents that are returned. -
addSort
-
addSort
-
nxql
Build the query from a NXQL string. You should either use nxql, either esQuery, not both. -
esQuery
Build the query using the Elasticsearch QueryBuilder API. You should either use nxql, either esQuery, not both. -
fetchFromElasticsearch
Ask for the Elasticsearch _source field, use it to build documents. -
hitDocConsumer
If search results are found, use this SearchHit and DocumentModel consumer on each hit.- Since:
- 10.2
-
useUnrestrictedSession
- Since:
- 11.1
-
fetchFromDatabase
Fetch the documents using VCS (database) engine. This is done by default -
onlyElasticsearchResponse
Don't return document model list, aggregates or rows, only the original Elasticsearch response is accessible fromEsResult.getElasticsearchResponse()- Since:
- 7.3
-
addAggregate
public NxQueryBuilder addAggregate(AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation, ? extends Bucket> aggregate) -
addAggregates
public NxQueryBuilder addAggregates(List<AggregateEsBase<? extends org.opensearch.search.aggregations.Aggregation, ? extends Bucket>> aggregates) -
highlight
- Since:
- 9.1
-
getLimit
public int getLimit() -
getOffset
public int getOffset() -
getSortInfos
-
getNxql
-
isFetchFromElasticsearch
public boolean isFetchFromElasticsearch() -
getSession
-
makeQuery
public org.opensearch.index.query.QueryBuilder makeQuery()Get the Elasticsearch queryBuilder. Note that it returns only the query part without order, limits nor aggregates, use the udpateRequest to get the full request. -
nxqlHasSelectClause
-
getSortBuilders
public org.opensearch.search.sort.SortBuilder<?>[] getSortBuilders() -
guessFieldType
-
getAggregateFilter
protected org.opensearch.index.query.QueryBuilder getAggregateFilter() -
getAggregateFilterExceptFor
-
getAggregates
-
getEsAggregates
public List<org.opensearch.search.aggregations.bucket.filter.FilterAggregationBuilder> getEsAggregates() -
updateRequest
public void updateRequest(org.opensearch.search.builder.SearchSourceBuilder request) -
addSecurityFilter
protected org.opensearch.index.query.QueryBuilder addSecurityFilter(org.opensearch.index.query.QueryBuilder query) -
addSearchRepository
Add a specific repository to search. Default search is done on the session repository only.- Since:
- 6.0
-
searchOnAllRepositories
Search on all available repositories.- Since:
- 6.0
-
getSearchRepositories
Return the list of repositories to search, or an empty list to search on all available repositories;- Since:
- 6.0
-
getFetcher
public Fetcher getFetcher(org.opensearch.action.search.SearchResponse response, Map<String, String> repoNames) - Since:
- 6.0
-
getFetcher
protected Fetcher getFetcher(CoreSession session, org.opensearch.action.search.SearchResponse response, Map<String, String> repoNames) -
getSelectFields
- Since:
- 7.2
-
getSelectFieldsAndTypes
- Since:
- 7.2
-
returnsDocuments
public boolean returnsDocuments()- Since:
- 7.2
-
returnsRows
public boolean returnsRows()
-