[Backport 8.11] Add missing snippets (#2115)
For https://github.com/elastic/clients-team/issues/728
(cherry picked from commit 5413eb5f35)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
This commit is contained in:
committed by
GitHub
parent
5ea47d84e0
commit
656550922e
12
docs/doc_examples/36b86b97feedcf5632824eefc251d6ed.asciidoc
Normal file
12
docs/doc_examples/36b86b97feedcf5632824eefc251d6ed.asciidoc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[source,js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: 'books',
|
||||||
|
query: {
|
||||||
|
match: {
|
||||||
|
name: 'brave'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(response)
|
||||||
|
----
|
||||||
13
docs/doc_examples/8575c966b004fb124c7afd6bb5827b50.asciidoc
Normal file
13
docs/doc_examples/8575c966b004fb124c7afd6bb5827b50.asciidoc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[source,js]
|
||||||
|
----
|
||||||
|
const response = await client.index({
|
||||||
|
index: 'books',
|
||||||
|
document: {
|
||||||
|
name: 'Snow Crash',
|
||||||
|
author: 'Neal Stephenson',
|
||||||
|
release_date: '1992-06-01',
|
||||||
|
page_count: 470,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(response)
|
||||||
|
----
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
[source,js]
|
||||||
|
----
|
||||||
|
const response = await client.search({
|
||||||
|
index: 'books'
|
||||||
|
})
|
||||||
|
console.log(response)
|
||||||
|
----
|
||||||
43
docs/doc_examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc
Normal file
43
docs/doc_examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
[source,js]
|
||||||
|
----
|
||||||
|
const response = await client.bulk({
|
||||||
|
operations: [
|
||||||
|
{ index: { _index: 'books' } },
|
||||||
|
{
|
||||||
|
name: 'Revelation Space',
|
||||||
|
author: 'Alastair Reynolds',
|
||||||
|
release_date: '2000-03-15',
|
||||||
|
page_count: 585,
|
||||||
|
},
|
||||||
|
{ index: { _index: 'books' } },
|
||||||
|
{
|
||||||
|
name: '1984',
|
||||||
|
author: 'George Orwell',
|
||||||
|
release_date: '1985-06-01',
|
||||||
|
page_count: 328,
|
||||||
|
},
|
||||||
|
{ index: { _index: 'books' } },
|
||||||
|
{
|
||||||
|
name: 'Fahrenheit 451',
|
||||||
|
author: 'Ray Bradbury',
|
||||||
|
release_date: '1953-10-15',
|
||||||
|
page_count: 227,
|
||||||
|
},
|
||||||
|
{ index: { _index: 'books' } },
|
||||||
|
{
|
||||||
|
name: 'Brave New World',
|
||||||
|
author: 'Aldous Huxley',
|
||||||
|
release_date: '1932-06-01',
|
||||||
|
page_count: 268,
|
||||||
|
},
|
||||||
|
{ index: { _index: 'books' } },
|
||||||
|
{
|
||||||
|
name: 'The Handmaids Tale',
|
||||||
|
author: 'Margaret Atwood',
|
||||||
|
release_date: '1985-06-01',
|
||||||
|
page_count: 311,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
console.log(response)
|
||||||
|
----
|
||||||
Reference in New Issue
Block a user