-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit b06b33a) Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
- Loading branch information
1 parent
e371574
commit 69c2a12
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// getting-started.asciidoc:245 | ||
|
||
[source, python] | ||
---- | ||
resp = client.search( | ||
index="books", | ||
body={"query": {"match": {"name": "brave"}}}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// getting-started.asciidoc:65 | ||
|
||
[source, python] | ||
---- | ||
resp = client.index( | ||
index="books", | ||
body={ | ||
"name": "Snow Crash", | ||
"author": "Neal Stephenson", | ||
"release_date": "1992-06-01", | ||
"page_count": 470, | ||
}, | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// getting-started.asciidoc:228 | ||
|
||
[source, python] | ||
---- | ||
resp = client.search( | ||
index="books", | ||
) | ||
print(resp) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// getting-started.asciidoc:104 | ||
|
||
[source, python] | ||
---- | ||
resp = client.bulk( | ||
body=[ | ||
{"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, | ||
}, | ||
], | ||
) | ||
print(resp) | ||
---- |