Update docs for v8 (#1572)
This commit is contained in:
committed by
GitHub
parent
a0c5c98a99
commit
759138c375
@ -16,7 +16,7 @@ async function run () {
|
||||
await client.index({
|
||||
index: 'game-of-thrones',
|
||||
id: '1',
|
||||
body: {
|
||||
document: {
|
||||
character: 'Ned Stark',
|
||||
quote: 'Winter is coming.',
|
||||
times: 0
|
||||
@ -26,23 +26,21 @@ async function run () {
|
||||
await client.update({
|
||||
index: 'game-of-thrones',
|
||||
id: '1',
|
||||
body: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
source: 'ctx._source.times++'
|
||||
// you can also use parameters
|
||||
// source: 'ctx._source.times += params.count',
|
||||
// params: { count: 1 }
|
||||
}
|
||||
script: {
|
||||
lang: 'painless',
|
||||
source: 'ctx._source.times++'
|
||||
// you can also use parameters
|
||||
// source: 'ctx._source.times += params.count',
|
||||
// params: { count: 1 }
|
||||
}
|
||||
})
|
||||
|
||||
const { body } = await client.get({
|
||||
const document = await client.get({
|
||||
index: 'game-of-thrones',
|
||||
id: '1'
|
||||
})
|
||||
|
||||
console.log(body)
|
||||
console.log(document)
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
@ -62,7 +60,7 @@ async function run () {
|
||||
await client.index({
|
||||
index: 'game-of-thrones',
|
||||
id: '1',
|
||||
body: {
|
||||
document: {
|
||||
character: 'Ned Stark',
|
||||
quote: 'Winter is coming.',
|
||||
isAlive: true
|
||||
@ -72,19 +70,17 @@ async function run () {
|
||||
await client.update({
|
||||
index: 'game-of-thrones',
|
||||
id: '1',
|
||||
body: {
|
||||
doc: {
|
||||
isAlive: false
|
||||
}
|
||||
doc: {
|
||||
isAlive: false
|
||||
}
|
||||
})
|
||||
|
||||
const { body } = await client.get({
|
||||
const document = await client.get({
|
||||
index: 'game-of-thrones',
|
||||
id: '1'
|
||||
})
|
||||
|
||||
console.log(body)
|
||||
console.log(document)
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
|
||||
Reference in New Issue
Block a user