Update docs to use async/await (#667)

* [docs] update readme and examples to use async/await

* [apis] regenerate (including updated examples)
This commit is contained in:
Spencer
2018-05-23 14:31:34 -07:00
committed by GitHub
parent a187ed6298
commit 83a464ac66
33 changed files with 1364 additions and 1760 deletions

View File

@ -1,26 +1,21 @@
.Get the number of all documents in the cluster
[source,js]
---------
client.count(function (error, response, status) {
// check for and handle error
var count = response.count;
});
const { count } = await client.count();
---------
.Get the number of documents in an index
[source,js]
---------
client.count({
const { count } = await client.count({
index: 'index_name'
}, function (error, response) {
// ...
});
---------
.Get the number of documents matching a query
[source,js]
---------
client.count({
const { count } = await client.count({
index: 'index_name',
body: {
query: {
@ -33,7 +28,5 @@ client.count({
}
}
}
}, function (err, response) {
// ...
});
---------