|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.client.action.support.BaseRequestBuilder<SearchRequest,SearchResponse> org.elasticsearch.client.action.search.SearchRequestBuilder
public class SearchRequestBuilder
A search action request builder.
Field Summary |
---|
Fields inherited from class org.elasticsearch.client.action.support.BaseRequestBuilder |
---|
client, request |
Constructor Summary | |
---|---|
SearchRequestBuilder(Client client)
|
Method Summary | |
---|---|
SearchRequestBuilder |
addFacet(AbstractFacetBuilder facet)
Adds a facet to the search operation. |
SearchRequestBuilder |
addField(java.lang.String field)
Adds a field to load and return (note, it must be stored) as part of the search request. |
SearchRequestBuilder |
addFields(java.lang.String... fields)
Adds the fields to load and return as part of the search request. |
SearchRequestBuilder |
addHighlightedField(java.lang.String name)
Adds a field to be highlighted with default fragment size of 100 characters, and default number of fragments of 5. |
SearchRequestBuilder |
addHighlightedField(java.lang.String name,
int fragmentSize)
Adds a field to be highlighted with a provided fragment size (in characters), and default number of fragments of 5. |
SearchRequestBuilder |
addHighlightedField(java.lang.String name,
int fragmentSize,
int numberOfFragments)
Adds a field to be highlighted with a provided fragment size (in characters), and a provided (maximum) number of fragments. |
SearchRequestBuilder |
addIndexBoost(java.lang.String index,
float indexBoost)
Sets the boost a specific index will receive when the query is executeed against it. |
SearchRequestBuilder |
addScriptField(java.lang.String name,
java.lang.String script)
Adds a script based field to load and return. |
SearchRequestBuilder |
addScriptField(java.lang.String name,
java.lang.String script,
java.util.Map<java.lang.String,java.lang.Object> params)
Adds a script based field to load and return. |
SearchRequestBuilder |
addScriptField(java.lang.String name,
java.lang.String lang,
java.lang.String script,
java.util.Map<java.lang.String,java.lang.Object> params)
Adds a script based field to load and return. |
SearchRequestBuilder |
addSort(SortBuilder sort)
Adds a generic sort builder. |
SearchRequestBuilder |
addSort(java.lang.String field,
SortOrder order)
Adds a sort against the given field name and the sort ordering. |
protected void |
doExecute(ActionListener<SearchResponse> listener)
|
SearchSourceBuilder |
internalBuilder()
Returns the internal search source builder used to construct the request. |
SearchRequestBuilder |
internalBuilder(SearchSourceBuilder sourceBuilder)
Sets the source builder to be used with this request. |
SearchRequestBuilder |
setExplain(boolean explain)
Should each SearchHit be returned with an
explanation of the hit (ranking). |
SearchRequestBuilder |
setFacets(byte[] facets)
Sets a raw (xcontent) binary representation of facets to use. |
SearchRequestBuilder |
setFilter(byte[] filter)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchRequestBuilder |
setFilter(java.lang.String filter)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchRequestBuilder |
setFilter(XContentFilterBuilder filter)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchRequestBuilder |
setFrom(int from)
From index to start the search from. |
SearchRequestBuilder |
setHighlighterOrder(java.lang.String order)
The order of fragments per field. |
SearchRequestBuilder |
setHighlighterPostTags(java.lang.String... postTags)
Explicitly set the post tags that will be used for highlighting. |
SearchRequestBuilder |
setHighlighterPreTags(java.lang.String... preTags)
Explicitly set the pre tags that will be used for highlighting. |
SearchRequestBuilder |
setHighlighterTagsSchema(java.lang.String schemaName)
Set a tag scheme that encapsulates a built in pre and post tags. |
SearchRequestBuilder |
setIndices(java.lang.String... indices)
Sets the indices the search will be executed on. |
SearchRequestBuilder |
setListenerThreaded(boolean listenerThreaded)
Should the listener be called on a separate thread if needed. |
SearchRequestBuilder |
setNoFields()
Sets no fields to be loaded, resulting in only id and type to be returned per field. |
SearchRequestBuilder |
setOperationThreading(SearchOperationThreading operationThreading)
Controls the the search operation threading model. |
SearchRequestBuilder |
setOperationThreading(java.lang.String operationThreading)
Sets the string representation of the operation threading model. |
SearchRequestBuilder |
setQuery(byte[] queryBinary)
Constructs a new search source builder with a raw search query. |
SearchRequestBuilder |
setQuery(java.lang.String query)
Constructs a new search source builder with a raw search query. |
SearchRequestBuilder |
setQuery(XContentQueryBuilder queryBuilder)
Constructs a new search source builder with a search query. |
SearchRequestBuilder |
setQueryHint(java.lang.String queryHint)
A query hint to optionally later be used when routing the request. |
SearchRequestBuilder |
setQueryParserName(java.lang.String queryParserName)
An optional query parser name to use. |
SearchRequestBuilder |
setRouting(java.lang.String... routing)
The routing values to control the shards that the search will be executed on. |
SearchRequestBuilder |
setRouting(java.lang.String routing)
A comma separated list of routing values to control the shards the search will be executed on. |
SearchRequestBuilder |
setScroll(Scroll scroll)
If set, will enable scrolling of the search request. |
SearchRequestBuilder |
setScroll(java.lang.String keepAlive)
If set, will enable scrolling of the search request for the specified timeout. |
SearchRequestBuilder |
setScroll(TimeValue keepAlive)
If set, will enable scrolling of the search request for the specified timeout. |
SearchRequestBuilder |
setSearchType(SearchType searchType)
The search type to execute, defaults to SearchType.DEFAULT . |
SearchRequestBuilder |
setSearchType(java.lang.String searchType)
The a string representation search type to execute, defaults to SearchType.DEFAULT . |
SearchRequestBuilder |
setSize(int size)
The number of search hits to return. |
SearchRequestBuilder |
setTimeout(java.lang.String timeout)
An optional timeout to control how long search is allowed to take. |
SearchRequestBuilder |
setTimeout(TimeValue timeout)
An optional timeout to control how long search is allowed to take. |
SearchRequestBuilder |
setTrackScores(boolean trackScores)
Applies when sorting, and controls if scores will be tracked as well. |
SearchRequestBuilder |
setTypes(java.lang.String... types)
The document types to execute the search against. |
SearchRequestBuilder |
setVersion(boolean version)
Should each SearchHit be returned with its
version. |
Methods inherited from class org.elasticsearch.client.action.support.BaseRequestBuilder |
---|
execute, execute, request |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SearchRequestBuilder(Client client)
Method Detail |
---|
public SearchRequestBuilder setIndices(java.lang.String... indices)
public SearchRequestBuilder setTypes(java.lang.String... types)
public SearchRequestBuilder setSearchType(SearchType searchType)
SearchType.DEFAULT
.
public SearchRequestBuilder setSearchType(java.lang.String searchType) throws ElasticSearchIllegalArgumentException
SearchType.DEFAULT
. Can be
one of "dfs_query_then_fetch"/"dfsQueryThenFetch", "dfs_query_and_fetch"/"dfsQueryAndFetch",
"query_then_fetch"/"queryThenFetch", and "query_and_fetch"/"queryAndFetch".
ElasticSearchIllegalArgumentException
public SearchRequestBuilder setScroll(Scroll scroll)
public SearchRequestBuilder setScroll(TimeValue keepAlive)
public SearchRequestBuilder setScroll(java.lang.String keepAlive)
public SearchRequestBuilder setTimeout(TimeValue timeout)
public SearchRequestBuilder setTimeout(java.lang.String timeout)
public SearchRequestBuilder setQueryHint(java.lang.String queryHint)
public SearchRequestBuilder setRouting(java.lang.String routing)
public SearchRequestBuilder setRouting(java.lang.String... routing)
public SearchRequestBuilder setOperationThreading(SearchOperationThreading operationThreading)
public SearchRequestBuilder setOperationThreading(java.lang.String operationThreading)
public SearchRequestBuilder setListenerThreaded(boolean listenerThreaded)
public SearchRequestBuilder setQuery(XContentQueryBuilder queryBuilder)
QueryBuilders
public SearchRequestBuilder setQuery(java.lang.String query)
public SearchRequestBuilder setQuery(byte[] queryBinary)
public SearchRequestBuilder setFilter(XContentFilterBuilder filter)
public SearchRequestBuilder setFilter(java.lang.String filter)
public SearchRequestBuilder setFilter(byte[] filter)
public SearchRequestBuilder setFrom(int from)
public SearchRequestBuilder setSize(int size)
public SearchRequestBuilder setQueryParserName(java.lang.String queryParserName)
public SearchRequestBuilder setExplain(boolean explain)
SearchHit
be returned with an
explanation of the hit (ranking).
public SearchRequestBuilder setVersion(boolean version)
SearchHit
be returned with its
version.
public SearchRequestBuilder addIndexBoost(java.lang.String index, float indexBoost)
index
- The index to apply the boost againstindexBoost
- The boost to apply to the indexpublic SearchRequestBuilder setNoFields()
public SearchRequestBuilder addField(java.lang.String field)
public SearchRequestBuilder addScriptField(java.lang.String name, java.lang.String script)
name
- The name that will represent this value in the return hitscript
- The script to usepublic SearchRequestBuilder addScriptField(java.lang.String name, java.lang.String script, java.util.Map<java.lang.String,java.lang.Object> params)
name
- The name that will represent this value in the return hitscript
- The script to useparams
- Parameters that the script can use.public SearchRequestBuilder addScriptField(java.lang.String name, java.lang.String lang, java.lang.String script, java.util.Map<java.lang.String,java.lang.Object> params)
name
- The name that will represent this value in the return hitlang
- The language of the scriptscript
- The script to useparams
- Parameters that the script can use (can be null).public SearchRequestBuilder addSort(java.lang.String field, SortOrder order)
field
- The name of the fieldorder
- The sort orderingpublic SearchRequestBuilder addSort(SortBuilder sort)
SortBuilders
public SearchRequestBuilder setTrackScores(boolean trackScores)
public SearchRequestBuilder addFields(java.lang.String... fields)
public SearchRequestBuilder addFacet(AbstractFacetBuilder facet)
public SearchRequestBuilder setFacets(byte[] facets)
public SearchRequestBuilder addHighlightedField(java.lang.String name)
name
- The field to highlightpublic SearchRequestBuilder addHighlightedField(java.lang.String name, int fragmentSize)
name
- The field to highlightfragmentSize
- The size of a fragment in characterspublic SearchRequestBuilder addHighlightedField(java.lang.String name, int fragmentSize, int numberOfFragments)
name
- The field to highlightfragmentSize
- The size of a fragment in charactersnumberOfFragments
- The (maximum) number of fragmentspublic SearchRequestBuilder setHighlighterTagsSchema(java.lang.String schemaName)
schemaName
- The tag scheme namepublic SearchRequestBuilder setHighlighterPreTags(java.lang.String... preTags)
public SearchRequestBuilder setHighlighterPostTags(java.lang.String... postTags)
public SearchRequestBuilder setHighlighterOrder(java.lang.String order)
public SearchRequestBuilder internalBuilder(SearchSourceBuilder sourceBuilder)
public SearchSourceBuilder internalBuilder()
protected void doExecute(ActionListener<SearchResponse> listener)
doExecute
in class BaseRequestBuilder<SearchRequest,SearchResponse>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |