Package org.elasticsearch.client.core
Class CountRequest
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportRequest
-
- org.elasticsearch.action.ActionRequest
-
- org.elasticsearch.client.core.CountRequest
-
- All Implemented Interfaces:
IndicesRequest
,IndicesRequest.Replaceable
,Streamable
,Writeable
,TaskAwareRequest
public final class CountRequest extends ActionRequest implements IndicesRequest.Replaceable
Encapsulates a request to _count API against one, several or all indices.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V extends java.lang.Object>, Writeable.Writer<V extends java.lang.Object>
-
-
Constructor Summary
Constructors Constructor Description CountRequest()
CountRequest(java.lang.String... indices)
Constructs a new count request against the indices.CountRequest(java.lang.String[] indices, SearchSourceBuilder searchSourceBuilder)
Constructs a new search request against the provided indices with the given search source.
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
java.lang.String[]
indices()
CountRequest
indices(java.lang.String... indices)
Sets the indices the count will be executed on.IndicesOptions
indicesOptions()
CountRequest
indicesOptions(IndicesOptions indicesOptions)
Returns the indices options used to resolve indices.java.lang.Float
minScore()
CountRequest
minScore(java.lang.Float minScore)
java.lang.String
preference()
CountRequest
preference(java.lang.String preference)
Sets the preference to execute the count.java.lang.String
routing()
CountRequest
routing(java.lang.String routing)
The routing values to control the shards that the search will be executed on.CountRequest
routing(java.lang.String... routings)
A comma separated list of routing values to control the shards the count will be executed on.SearchSourceBuilder
source()
CountRequest
source(SearchSourceBuilder searchSourceBuilder)
The source of the count request.int
terminateAfter()
CountRequest
terminateAfter(int terminateAfter)
java.lang.String[]
types()
CountRequest
types(java.lang.String... types)
Deprecated.Types are going away, prefer filtering on a type.ActionRequestValidationException
validate()
-
Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult, readFrom, writeTo
-
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, getDescription, setParentTask
-
-
-
-
Constructor Detail
-
CountRequest
public CountRequest()
-
CountRequest
public CountRequest(java.lang.String... indices)
Constructs a new count request against the indices. No indices provided here means that count will execute on all indices.
-
CountRequest
public CountRequest(java.lang.String[] indices, SearchSourceBuilder searchSourceBuilder)
Constructs a new search request against the provided indices with the given search source.
-
-
Method Detail
-
validate
public ActionRequestValidationException validate()
- Specified by:
validate
in classActionRequest
-
indices
public CountRequest indices(java.lang.String... indices)
Sets the indices the count will be executed on.- Specified by:
indices
in interfaceIndicesRequest.Replaceable
-
source
public CountRequest source(SearchSourceBuilder searchSourceBuilder)
The source of the count request.
-
types
@Deprecated public CountRequest types(java.lang.String... types)
Deprecated.Types are going away, prefer filtering on a type.The document types to execute the count against. Defaults to be executed against all types.
-
routing
public CountRequest routing(java.lang.String routing)
The routing values to control the shards that the search will be executed on.
-
routing
public CountRequest routing(java.lang.String... routings)
A comma separated list of routing values to control the shards the count will be executed on.
-
indicesOptions
public CountRequest indicesOptions(IndicesOptions indicesOptions)
Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.- See Also:
IndicesOptions
-
preference
public CountRequest preference(java.lang.String preference)
Sets the preference to execute the count. Defaults to randomize across shards. Can be set to_local
to prefer local shards or a custom value, which guarantees that the same order will be used across different requests.
-
indicesOptions
public IndicesOptions indicesOptions()
- Specified by:
indicesOptions
in interfaceIndicesRequest
-
routing
public java.lang.String routing()
-
preference
public java.lang.String preference()
-
indices
public java.lang.String[] indices()
- Specified by:
indices
in interfaceIndicesRequest
-
minScore
public java.lang.Float minScore()
-
minScore
public CountRequest minScore(java.lang.Float minScore)
-
terminateAfter
public int terminateAfter()
-
terminateAfter
public CountRequest terminateAfter(int terminateAfter)
-
types
public java.lang.String[] types()
-
source
public SearchSourceBuilder source()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-