* [docs] update readme and examples to use async/await * [apis] regenerate (including updated examples)
33 lines
547 B
Plaintext
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']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
---------
|