Files
elasticsearch-js/docs/_examples/count.asciidoc
Spencer 83a464ac66 Update docs to use async/await (#667)
* [docs] update readme and examples to use async/await

* [apis] regenerate (including updated examples)
2018-05-23 14:31:34 -07:00

33 lines
547 B
Plaintext

.Get the number of all documents in the cluster
[source,js]
---------
const { count } = await client.count();
---------
.Get the number of documents in an index
[source,js]
---------
const { count } = await client.count({
index: 'index_name'
});
---------
.Get the number of documents matching a query
[source,js]
---------
const { count } = await client.count({
index: 'index_name',
body: {
query: {
filtered: {
filter: {
terms: {
foo: ['bar']
}
}
}
}
}
});
---------