|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.action.search.SearchRequest
public class SearchRequest
A request to execute search against one or more indices (or all). Best created using
Requests.searchRequest(String...)
.
Note, the search source(org.elasticsearch.search.builder.SearchSourceBuilder)
is required. The search source is the different search options, including facets and such.
There is an option to specify an addition search source using the extraSource(org.elasticsearch.search.builder.SearchSourceBuilder)
.
Requests.searchRequest(String...)
,
Client.search(SearchRequest)
,
SearchResponse
Constructor Summary | |
---|---|
SearchRequest()
|
|
SearchRequest(String... indices)
Constructs a new search request against the indices. |
|
SearchRequest(String[] indices,
byte[] source)
Constructs a new search request against the provided indices with the given search source. |
Method Summary | |
---|---|
void |
beforeLocalFork()
Internal. |
void |
beforeStart()
|
BytesReference |
extraSource()
Additional search source to execute. |
SearchRequest |
extraSource(byte[] source)
Allows to provide additional source that will be used as well. |
SearchRequest |
extraSource(byte[] source,
int offset,
int length)
Allows to provide additional source that will be used as well. |
SearchRequest |
extraSource(byte[] source,
int offset,
int length,
boolean unsafe)
Allows to provide additional source that will be used as well. |
SearchRequest |
extraSource(BytesReference source,
boolean unsafe)
Allows to provide additional source that will be used as well. |
SearchRequest |
extraSource(Map extraSource)
|
SearchRequest |
extraSource(SearchSourceBuilder sourceBuilder)
Allows to provide additional source that will be used as well. |
SearchRequest |
extraSource(String source)
Allows to provide additional source that will use used as well. |
SearchRequest |
extraSource(XContentBuilder builder)
|
IgnoreIndices |
ignoreIndices()
|
SearchRequest |
ignoreIndices(IgnoreIndices ignoreIndices)
|
String[] |
indices()
The indices |
SearchRequest |
indices(String... indices)
Sets the indices the search will be executed on. |
boolean |
listenerThreaded()
Should the listener be called on a separate thread if needed. |
SearchRequest |
listenerThreaded(boolean listenerThreaded)
Should the listener be called on a separate thread if needed. |
SearchOperationThreading |
operationThreading()
Controls the the search operation threading model. |
SearchRequest |
operationThreading(SearchOperationThreading operationThreading)
Controls the the search operation threading model. |
SearchRequest |
operationThreading(String operationThreading)
Sets the string representation of the operation threading model. |
String |
preference()
|
SearchRequest |
preference(String preference)
Sets the preference to execute the search. |
String |
queryHint()
A query hint to optionally later be used when routing the request. |
SearchRequest |
queryHint(String queryHint)
A query hint to optionally later be used when routing the request. |
void |
readFrom(StreamInput in)
|
String |
routing()
A comma separated list of routing values to control the shards the search will be executed on. |
SearchRequest |
routing(String... routings)
The routing values to control the shards that the search will be executed on. |
SearchRequest |
routing(String routing)
A comma separated list of routing values to control the shards the search will be executed on. |
Scroll |
scroll()
If set, will enable scrolling of the search request. |
SearchRequest |
scroll(Scroll scroll)
If set, will enable scrolling of the search request. |
SearchRequest |
scroll(String keepAlive)
If set, will enable scrolling of the search request for the specified timeout. |
SearchRequest |
scroll(TimeValue keepAlive)
If set, will enable scrolling of the search request for the specified timeout. |
SearchType |
searchType()
The tye of search to execute. |
SearchRequest |
searchType(SearchType searchType)
The search type to execute, defaults to SearchType.DEFAULT . |
SearchRequest |
searchType(String searchType)
The a string representation search type to execute, defaults to SearchType.DEFAULT . |
BytesReference |
source()
The search source to execute. |
SearchRequest |
source(byte[] source)
The search source to execute. |
SearchRequest |
source(byte[] source,
int offset,
int length)
The search source to execute. |
SearchRequest |
source(byte[] source,
int offset,
int length,
boolean unsafe)
The search source to execute. |
SearchRequest |
source(BytesReference source,
boolean unsafe)
The search source to execute. |
SearchRequest |
source(Map source)
The source of the search request in the form of a map. |
SearchRequest |
source(SearchSourceBuilder sourceBuilder)
The source of the search request. |
SearchRequest |
source(String source)
The source of the search request. |
SearchRequest |
source(XContentBuilder builder)
|
String[] |
types()
The document types to execute the search against. |
SearchRequest |
types(String... types)
The document types to execute the search against. |
ActionRequestValidationException |
validate()
|
void |
writeTo(StreamOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SearchRequest()
public SearchRequest(String... indices)
public SearchRequest(String[] indices, byte[] source)
Method Detail |
---|
public ActionRequestValidationException validate()
validate
in interface ActionRequest
public void beforeStart()
public void beforeLocalFork()
public boolean listenerThreaded()
listenerThreaded
in interface ActionRequest
public SearchRequest indices(String... indices)
public SearchRequest listenerThreaded(boolean listenerThreaded)
listenerThreaded
in interface ActionRequest
public SearchOperationThreading operationThreading()
public SearchRequest operationThreading(SearchOperationThreading operationThreading)
public SearchRequest operationThreading(String operationThreading)
public IgnoreIndices ignoreIndices()
public SearchRequest ignoreIndices(IgnoreIndices ignoreIndices)
public String[] types()
public SearchRequest types(String... types)
public String routing()
public SearchRequest routing(String routing)
public SearchRequest routing(String... routings)
public SearchRequest preference(String preference)
public String preference()
public SearchRequest searchType(SearchType searchType)
SearchType.DEFAULT
.
public SearchRequest searchType(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 SearchRequest source(SearchSourceBuilder sourceBuilder)
public SearchRequest source(String source)
source(byte[])
or
source(org.elasticsearch.search.builder.SearchSourceBuilder)
.
public SearchRequest source(Map source)
public SearchRequest source(XContentBuilder builder)
public SearchRequest source(byte[] source)
public SearchRequest source(byte[] source, int offset, int length)
public SearchRequest source(byte[] source, int offset, int length, boolean unsafe)
public SearchRequest source(BytesReference source, boolean unsafe)
public BytesReference source()
public SearchRequest extraSource(SearchSourceBuilder sourceBuilder)
public SearchRequest extraSource(Map extraSource)
public SearchRequest extraSource(XContentBuilder builder)
public SearchRequest extraSource(String source)
public SearchRequest extraSource(byte[] source)
public SearchRequest extraSource(byte[] source, int offset, int length)
public SearchRequest extraSource(byte[] source, int offset, int length, boolean unsafe)
public SearchRequest extraSource(BytesReference source, boolean unsafe)
public BytesReference extraSource()
public SearchType searchType()
public String[] indices()
public SearchRequest queryHint(String queryHint)
public String queryHint()
public Scroll scroll()
public SearchRequest scroll(Scroll scroll)
public SearchRequest scroll(TimeValue keepAlive)
public SearchRequest scroll(String keepAlive)
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
IOException
public void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |