Update docs for v8 (#1572)

This commit is contained in:
Tomas Della Vedova
2022-02-11 10:23:07 +01:00
committed by delvedor
parent 221f9a9798
commit 5086a19512
37 changed files with 315 additions and 1264 deletions

View File

@ -19,7 +19,7 @@ const client = new Client({
async function run () {
await client.indices.create({
index: 'tweets',
body: {
operations: {
mappings: {
properties: {
id: { type: 'integer' },
@ -58,9 +58,9 @@ async function run () {
date: new Date()
}]
const body = dataset.flatMap(doc => [{ index: { _index: 'tweets' } }, doc])
const operations = dataset.flatMap(doc => [{ index: { _index: 'tweets' } }, doc])
const { body: bulkResponse } = await client.bulk({ refresh: true, body })
const bulkResponse = await client.bulk({ refresh: true, operations })
if (bulkResponse.errors) {
const erroredDocuments = []
@ -84,7 +84,7 @@ async function run () {
console.log(erroredDocuments)
}
const { body: count } = await client.count({ index: 'tweets' })
const count = await client.count({ index: 'tweets' })
console.log(count)
}