2013-08-28 19:24:34 -04:00
|
|
|
[[count]]
|
|
|
|
== Count API
|
|
|
|
|
|
|
|
The count API is very similar to the
|
2013-09-03 10:15:28 -04:00
|
|
|
{java}/count.html[Java count API]. The Groovy
|
2013-08-28 19:24:34 -04:00
|
|
|
extension allows to provide the query to execute as a `Closure` (similar
|
|
|
|
to GORM criteria builder):
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
def count = client.count {
|
|
|
|
indices "test"
|
|
|
|
types "type1"
|
|
|
|
query {
|
|
|
|
term {
|
|
|
|
test = "value"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
2013-09-03 10:15:28 -04:00
|
|
|
The query follows the same {ref}/query-dsl.html[Query DSL].
|