S - The type actually exposed to the user for this context (may be a subtype of SearchQueryContext, with more exposed methods).H - The type of hits for the created query.SC - The type of contexts used to create sorts in sort(Function).public interface SearchQueryContext<S extends SearchQueryContext<? extends S,H,SC>,H,SC extends SearchSortFactoryContext> extends SearchFetchable<H>
| Modifier and Type | Method and Description |
|---|---|
S |
routing(Collection<String> routingKeys)
Configure routing of the search query.
|
S |
routing(String routingKey)
Configure routing of the search query.
|
S |
sort(Function<? super SC,? extends SearchSortTerminalContext> sortContributor)
Add a sort to this query.
|
S |
sort(SearchSort sort)
Add a sort to this query.
|
SearchQuery<H> |
toQuery() |
fetch, fetch, fetch, fetchHits, fetchHits, fetchHits, fetchSingleHit, fetchTotalHitCountS routing(String routingKey)
Useful when indexes are sharded, to limit the number of shards interrogated by the search query.
This method may be called multiple times, in which case all submitted routing keys will be taken into account.
By default, if routing is not configured, all shards will be queried.
routingKey - A string key. All shards matching this key will be queried.this, for method chaining.S routing(Collection<String> routingKeys)
Similar to routing(String), but allows passing multiple keys in a single call.
routingKeys - A collection containing zero, one or multiple string keys.this, for method chaining.S sort(SearchSort sort)
sort - A SearchSort object obtained from the search scope.this, for method chaining.S sort(Function<? super SC,? extends SearchSortTerminalContext> sortContributor)
sortContributor - A function that will use the DSL context passed in parameter to create a sort,
returning the resulting terminal context.
Should generally be a lambda expression.this, for method chaining.SearchQuery<H> toQuery()
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.