count.asciidoc 519 B

12345678910111213141516171819202122
  1. [[count]]
  2. == Count API
  3. The count API is very similar to the
  4. {java}/count.html[Java count API]. The Groovy
  5. extension allows to provide the query to execute as a `Closure` (similar
  6. to GORM criteria builder):
  7. [source,js]
  8. --------------------------------------------------
  9. def count = client.count {
  10. indices "test"
  11. types "type1"
  12. query {
  13. term {
  14. test = "value"
  15. }
  16. }
  17. }
  18. --------------------------------------------------
  19. The query follows the same {ref}/query-dsl.html[Query DSL].