Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/rest-api/common-parms.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ end::search-q[]

tag::query[]
`query`::
(Optional, <<query-dsl,query object>>) Defines the search definition using the
(Optional, <<query-dsl,query object>>) Defines the search query using
<<query-dsl,Query DSL>>.
end::query[]

Expand Down
16 changes: 7 additions & 9 deletions docs/reference/search/count.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ GET /my-index-000001/_count?q=user:kimchy
--------------------------------------------------
// TEST[setup:my_index]

NOTE: The query being sent in the body must be nested in a `query` key, same as
the <<search-search,search API>> works.


[[search-count-api-request]]
==== {api-request-title}

Expand All @@ -39,9 +35,9 @@ or alias.
==== {api-description-title}

The count API allows you to execute a query and get the number of matches for
that query. The query can either
be provided using a simple query string as a parameter, or using the
<<query-dsl,Query DSL>> defined within the request body.
that query. To provide the query, you can either include the <<search-count-api-query-params,`q` query string parameter>>
or define <<query-dsl,Query DSL>> within the <<search-count-request-body,request body>>. Use only one of these options —
if you specify the `q` parameter and also send a request body, an error is returned.

The count API supports <<api-multi-index,multi-target syntax>>. You can run a single
count API search across multiple data streams and indices.
Expand Down Expand Up @@ -92,6 +88,8 @@ include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=lenient]
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=preference]

include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=search-q]
+
NOTE: If the `q` parameter is specified, the count API does not accept a <<search-count-request-body,request body>>.

include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=routing]

Expand Down Expand Up @@ -140,5 +138,5 @@ Both examples above do the same: count the number of documents in
}
--------------------------------------------------

The query is optional, and when not provided, it will use `match_all` to
count all the docs.
The query is optional. When no query is provided, the API uses `match_all` to
count all the documents.