Class CountRequest
- All Implemented Interfaces:
JsonpSerializable
The query can be provided either by using a simple query string as a
parameter, or by defining Query DSL within the request body. The query is
optional. When no query is provided, the API uses match_all to
count all the documents.
The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.
The operation is broadcast across all shards. For each shard ID group, a replica is chosen and the search is run against it. This means that replicas increase the scalability of the count.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<CountRequest>Json deserializer forCountRequeststatic final Endpoint<CountRequest,CountResponse, ErrorResponse> Endpoint "count". -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanIffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices.final Stringanalyzer()The analyzer to use for the query string.final BooleanIftrue, wildcard and prefix queries are analyzed.final OperatorThe default operator for query string query:andoror.final Stringdf()The field to use as a default when no field prefix is given in the query string.final List<ExpandWildcard>The type of index that wildcard patterns can match.final BooleanDeprecated.7.16.0final BooleanIffalse, the request returns an error if it targets a missing or closed index.index()A comma-separated list of data streams, indices, and aliases to search.final Booleanlenient()Iftrue, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.final DoubleminScore()The minimum_scorevalue that documents must have to be included in the result.static CountRequestfinal StringThe node or shard the operation should be performed on.final StringSpecifies a subset of projects to target for the search using project metadata tags in a subset of Lucene query syntax.final Stringq()The query in Lucene query string syntax.final Queryquery()Defines the search query using Query DSL.final Stringrouting()A custom value used to route operations to a specific shard.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static voidfinal LongThe maximum number of documents to collect for each shard.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forCountRequest -
_ENDPOINT
Endpoint "count".
-
-
Method Details
-
of
-
allowNoIndices
Iffalse, the request returns an error if any wildcard expression, index alias, or_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*returns an error if an index starts withfoobut no index starts withbar.API name:
allow_no_indices -
analyzeWildcard
Iftrue, wildcard and prefix queries are analyzed. This parameter can be used only when theqquery string parameter is specified.API name:
analyze_wildcard -
analyzer
The analyzer to use for the query string. This parameter can be used only when theqquery string parameter is specified.API name:
analyzer -
defaultOperator
The default operator for query string query:andoror. This parameter can be used only when theqquery string parameter is specified.API name:
default_operator -
df
The field to use as a default when no field prefix is given in the query string. This parameter can be used only when theqquery string parameter is specified.API name:
df -
expandWildcards
The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values, such asopen,hidden.API name:
expand_wildcards -
ignoreThrottled
Deprecated.7.16.0Iftrue, concrete, expanded, or aliased indices are ignored when frozen.API name:
ignore_throttled -
index
A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use*or_all.API name:
index -
lenient
Iftrue, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when theqquery string parameter is specified.API name:
lenient -
minScore
The minimum_scorevalue that documents must have to be included in the result.API name:
min_score -
preference
The node or shard the operation should be performed on. By default, it is random.API name:
preference -
projectRouting
Specifies a subset of projects to target for the search using project metadata tags in a subset of Lucene query syntax. Allowed Lucene queries: the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project _alias:_origin _alias:pr Supported in serverless only.API name:
project_routing -
q
The query in Lucene query string syntax. This parameter cannot be used with a request body.API name:
q -
query
Defines the search query using Query DSL. A request body query cannot be used with theqquery string parameter.API name:
query -
routing
A custom value used to route operations to a specific shard.API name:
routing -
terminateAfter
The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.
API name:
terminate_after -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
setupCountRequestDeserializer
-