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:
org.elasticsearch.action.IndicesRequest,org.elasticsearch.action.IndicesRequest.Replaceable,org.elasticsearch.common.io.stream.Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject,org.elasticsearch.tasks.TaskAwareRequest
public final class CountRequest
extends org.elasticsearch.action.ActionRequest
implements org.elasticsearch.action.IndicesRequest.Replaceable, org.elasticsearch.common.xcontent.ToXContentObject
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
org.elasticsearch.transport.TransportRequest.EmptyNested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
org.elasticsearch.action.IndicesRequest.Replaceable -
Field Summary
-
Constructor Summary
Constructors Constructor Description CountRequest()CountRequest(java.lang.String... indices)Constructs a new count request against the indices.CountRequest(java.lang.String[] indices, org.elasticsearch.index.query.QueryBuilder query)Constructs a new search request against the provided indices with the given query.CountRequest(java.lang.String[] indices, org.elasticsearch.search.builder.SearchSourceBuilder searchSourceBuilder)Deprecated.The count api only supports a query. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()java.lang.String[]indices()CountRequestindices(java.lang.String... indices)Sets the indices the count will be executed on.org.elasticsearch.action.support.IndicesOptionsindicesOptions()CountRequestindicesOptions(org.elasticsearch.action.support.IndicesOptions indicesOptions)Returns the indices options used to resolve indices.java.lang.FloatminScore()CountRequestminScore(java.lang.Float minScore)java.lang.Stringpreference()CountRequestpreference(java.lang.String preference)Sets the preference to execute the count.org.elasticsearch.index.query.QueryBuilderquery()CountRequestquery(org.elasticsearch.index.query.QueryBuilder query)Sets the query to execute for this count request.java.lang.Stringrouting()CountRequestrouting(java.lang.String routing)The routing values to control the shards that the search will be executed on.CountRequestrouting(java.lang.String... routings)A comma separated list of routing values to control the shards the count will be executed on.org.elasticsearch.search.builder.SearchSourceBuildersource()Deprecated.The count api only supports a query.CountRequestsource(org.elasticsearch.search.builder.SearchSourceBuilder searchSourceBuilder)Deprecated.The count api only supports a query.intterminateAfter()CountRequestterminateAfter(int terminateAfter)org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)java.lang.String[]types()Deprecated.Types are in the process of being removed.CountRequesttypes(java.lang.String... types)Deprecated.Types are in the process of being removed.org.elasticsearch.action.ActionRequestValidationExceptionvalidate()Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTaskMethods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddressMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
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
@Deprecated public CountRequest(java.lang.String[] indices, org.elasticsearch.search.builder.SearchSourceBuilder searchSourceBuilder)Deprecated.The count api only supports a query. UseCountRequest(String[], QueryBuilder)instead.Constructs a new search request against the provided indices with the given search source. -
CountRequest
public CountRequest(java.lang.String[] indices, org.elasticsearch.index.query.QueryBuilder query)Constructs a new search request against the provided indices with the given query.
-
-
Method Details
-
validate
public org.elasticsearch.action.ActionRequestValidationException validate()- Specified by:
validatein classorg.elasticsearch.action.ActionRequest
-
indices
Sets the indices the count will be executed on.- Specified by:
indicesin interfaceorg.elasticsearch.action.IndicesRequest.Replaceable
-
source
@Deprecated public CountRequest source(org.elasticsearch.search.builder.SearchSourceBuilder searchSourceBuilder)Deprecated.The count api only supports a query. Usequery(QueryBuilder)instead.The source of the count request. -
query
Sets the query to execute for this count request. -
types
Deprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document.The document types to execute the count against. Defaults to be executed against all types. -
routing
The routing values to control the shards that the search will be executed on. -
routing
A comma separated list of routing values to control the shards the count will be executed on. -
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
Sets the preference to execute the count. Defaults to randomize across shards. Can be set to_localto prefer local shards or a custom value, which guarantees that the same order will be used across different requests. -
indicesOptions
public org.elasticsearch.action.support.IndicesOptions indicesOptions()- Specified by:
indicesOptionsin interfaceorg.elasticsearch.action.IndicesRequest
-
routing
public java.lang.String routing() -
preference
public java.lang.String preference() -
indices
public java.lang.String[] indices()- Specified by:
indicesin interfaceorg.elasticsearch.action.IndicesRequest
-
minScore
public java.lang.Float minScore() -
minScore
-
terminateAfter
public int terminateAfter() -
terminateAfter
-
types
@Deprecated public java.lang.String[] types()Deprecated.Types are in the process of being removed. Instead of using a type, prefer to filter on a field on the document. -
source
@Deprecated public org.elasticsearch.search.builder.SearchSourceBuilder source()Deprecated.The count api only supports a query. Usequery()instead.- Returns:
- the source builder
-
query
public org.elasticsearch.index.query.QueryBuilder query()- Returns:
- The provided query to execute with the count request or
nullif no query was provided.
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-