Skip to content

Commit b06b33a

Browse files
authored
Add Elasticsearch quickstart examples (#2394)
1 parent ff2ef4d commit b06b33a

4 files changed

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

0 commit comments

Comments
 (0)