Skip to content

Commit

Permalink
Add Elasticsearch quickstart examples (#2394) (#2397)
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
github-actions[bot] and leemthompo committed Dec 6, 2023
1 parent e371574 commit 69c2a12
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc
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)
----
15 changes: 15 additions & 0 deletions docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc
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)
----
9 changes: 9 additions & 0 deletions docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc
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)
----
45 changes: 45 additions & 0 deletions docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc
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)
----

0 comments on commit 69c2a12

Please sign in to comment.