Skip to content

Commit 7324851

Browse files
committed
Clarify query methods; other sprucing
1 parent f404da0 commit 7324851

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

docs/reference/rest-api/common-parms.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ end::search-q[]
875875

876876
tag::query[]
877877
`query`::
878-
(Optional, <<query-dsl,query object>>) Defines the search definition using the
878+
(Optional, <<query-dsl,query object>>) Defines the search query using
879879
<<query-dsl,Query DSL>>.
880880
end::query[]
881881

docs/reference/search/count.asciidoc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ GET /my-index-000001/_count?q=user:kimchy
1818
--------------------------------------------------
1919
// TEST[setup:my_index]
2020

21-
NOTE: The query being sent in the body must be nested in a `query` key, same as
22-
the <<search-search,search API>> works.
23-
24-
2521
[[search-count-api-request]]
2622
==== {api-request-title}
2723

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

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

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

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

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

@@ -140,5 +138,5 @@ Both examples above do the same: count the number of documents in
140138
}
141139
--------------------------------------------------
142140

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

0 commit comments

Comments
 (0)