Skip to content

Commit 6565509

Browse files
[Backport 8.11] Add missing snippets (#2115)
For elastic/devtools-team#728 (cherry picked from commit 5413eb5) Co-authored-by: Josh Mock <[email protected]>
1 parent 5ea47d8 commit 6565509

4 files changed

+75
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[source,js]
2+
----
3+
const response = await client.search({
4+
index: 'books',
5+
query: {
6+
match: {
7+
name: 'brave'
8+
}
9+
}
10+
})
11+
console.log(response)
12+
----
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[source,js]
2+
----
3+
const response = await client.index({
4+
index: 'books',
5+
document: {
6+
name: 'Snow Crash',
7+
author: 'Neal Stephenson',
8+
release_date: '1992-06-01',
9+
page_count: 470,
10+
}
11+
})
12+
console.log(response)
13+
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[source,js]
2+
----
3+
const response = await client.search({
4+
index: 'books'
5+
})
6+
console.log(response)
7+
----
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[source,js]
2+
----
3+
const response = await client.bulk({
4+
operations: [
5+
{ index: { _index: 'books' } },
6+
{
7+
name: 'Revelation Space',
8+
author: 'Alastair Reynolds',
9+
release_date: '2000-03-15',
10+
page_count: 585,
11+
},
12+
{ index: { _index: 'books' } },
13+
{
14+
name: '1984',
15+
author: 'George Orwell',
16+
release_date: '1985-06-01',
17+
page_count: 328,
18+
},
19+
{ index: { _index: 'books' } },
20+
{
21+
name: 'Fahrenheit 451',
22+
author: 'Ray Bradbury',
23+
release_date: '1953-10-15',
24+
page_count: 227,
25+
},
26+
{ index: { _index: 'books' } },
27+
{
28+
name: 'Brave New World',
29+
author: 'Aldous Huxley',
30+
release_date: '1932-06-01',
31+
page_count: 268,
32+
},
33+
{ index: { _index: 'books' } },
34+
{
35+
name: 'The Handmaids Tale',
36+
author: 'Margaret Atwood',
37+
release_date: '1985-06-01',
38+
page_count: 311,
39+
}
40+
]
41+
})
42+
console.log(response)
43+
----

0 commit comments

Comments
 (0)