The Groovy API is no longer actively maintained or supported.
Count API
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Count API
editDeprecated in 2.1.0.
Use the search api instead and set size to 0
The count API is very similar to the
Java count API. The Groovy
extension allows to provide the query to execute as a Closure (similar
to GORM criteria builder):
def count = client.count {
indices "test"
types "type1"
query {
term {
test = "value"
}
}
}
The query follows the same Query DSL.