Skip to content

Commit 04fee08

Browse files
authored
Update client examples for 2020-05-26
1 parent 1fa6cb8 commit 04fee08

File tree

109 files changed

+892
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+892
-106
lines changed

docs/examples/028f6d6ac2594e20b78b8a8f8cbad49d.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:470
1+
// aggregations/bucket/terms-aggregation.asciidoc:336
22

33
[source, python]
44
----

docs/examples/033778305d52746f5ce0a2a922c8e521.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:544
1+
// aggregations/bucket/terms-aggregation.asciidoc:410
22

33
[source, python]
44
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// cluster/health.asciidoc:35
2+
3+
[source, python]
4+
----
5+
resp = client.cluster.health(wait_for_status="yellow", timeout="50s")
6+
print(resp)
7+
----

docs/examples/0afaf1cad692e6201aa574c8feb6e622.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:626
1+
// aggregations/bucket/terms-aggregation.asciidoc:492
22

33
[source, python]
44
----

docs/examples/0ba0b2db24852abccb7c0fc1098d566e.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// docs/get.asciidoc:363
1+
// docs/get.asciidoc:366
22

33
[source, python]
44
----
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// query-dsl/nested-query.asciidoc:206
2+
3+
[source, python]
4+
----
5+
resp = client.search(
6+
index="drivers",
7+
body={
8+
"query": {
9+
"nested": {
10+
"path": "driver",
11+
"query": {
12+
"nested": {
13+
"path": "driver.vehicle",
14+
"query": {
15+
"bool": {
16+
"must": [
17+
{
18+
"match": {
19+
"driver.vehicle.make": "Powell Motors"
20+
}
21+
},
22+
{
23+
"match": {
24+
"driver.vehicle.model": "Canyonero"
25+
}
26+
},
27+
]
28+
}
29+
},
30+
}
31+
},
32+
}
33+
}
34+
},
35+
)
36+
print(resp)
37+
----
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// indices/update-settings.asciidoc:114
2+
3+
[source, python]
4+
----
5+
resp = client.indices.put_settings(
6+
index="twitter", body={"index": {"refresh_interval": "1s"}},
7+
)
8+
print(resp)
9+
----

docs/examples/0ce3606f1dba490eef83c4317b315b62.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// search/request-body.asciidoc:92
1+
// search/request-body.asciidoc:7
22

33
[source, python]
44
----

docs/examples/168bfdde773570cfc6dd3ab3574e413b.asciidoc

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// docs/bulk.asciidoc:544
1+
// docs/bulk.asciidoc:548
22

33
[source, python]
44
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// search/count.asciidoc:7
2+
3+
[source, python]
4+
----
5+
resp = client.count(index="twitter", q="user:kimchy")
6+
print(resp)
7+
----

docs/examples/1b8caf0a6741126c6d0ad83b56fce290.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// indices/templates.asciidoc:136
1+
// indices/templates.asciidoc:148
22

33
[source, python]
44
----
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// indices/aliases.asciidoc:292
2+
3+
[source, python]
4+
----
5+
resp = client.indices.create(
6+
index="test1",
7+
body={"mappings": {"properties": {"user": {"type": "keyword"}}}},
8+
)
9+
print(resp)
10+
----

docs/examples/2468ab381257d759d8a88af1141f6f9c.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// docs/get.asciidoc:285
1+
// docs/get.asciidoc:288
22

33
[source, python]
44
----

docs/examples/28aad2c5942bfb221c2bf1bbdc01658e.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// query-dsl/query-string-query.asciidoc:306
1+
// query-dsl/query-string-query.asciidoc:316
22

33
[source, python]
44
----

docs/examples/34efeade38445b2834749ced59782e25.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:397
1+
// aggregations/bucket/terms-aggregation.asciidoc:263
22

33
[source, python]
44
----

docs/examples/35e8da9410b8432cf4095f2541ad7b1d.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:264
1+
// aggregations/bucket/terms-aggregation.asciidoc:162
22

33
[source, python]
44
----
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// indices/aliases.asciidoc:178
2+
3+
[source, python]
4+
----
5+
resp = client.indices.update_aliases(
6+
body={"actions": [{"remove": {"index": "test1", "alias": "alias1"}}]},
7+
)
8+
print(resp)
9+
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// setup/install/check-running.asciidoc:7
2+
3+
[source, python]
4+
----
5+
resp = client.info()
6+
print(resp)
7+
----
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// indices/update-settings.asciidoc:73
2+
3+
[source, python]
4+
----
5+
resp = client.indices.put_settings(
6+
index="twitter", body={"index": {"refresh_interval": None}},
7+
)
8+
print(resp)
9+
----
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// indices/aliases.asciidoc:382
2+
3+
[source, python]
4+
----
5+
resp = client.search(index="alias2", q="user:kimchy", routing="2,3")
6+
print(resp)
7+
----

docs/examples/43682666e1abcb14770c99f02eb26a0d.asciidoc

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/4646764bf09911fee7d58630c72d3137.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:578
1+
// aggregations/bucket/terms-aggregation.asciidoc:444
22

33
[source, python]
44
----

docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// indices/templates.asciidoc:239
1+
// indices/templates.asciidoc:251
22

33
[source, python]
44
----
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// mapping/types/keyword.asciidoc:20
2+
3+
[source, python]
4+
----
5+
resp = client.indices.create(
6+
index="my_index",
7+
body={"mappings": {"properties": {"tags": {"type": "keyword"}}}},
8+
)
9+
print(resp)
10+
----
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// mapping/types/array.asciidoc:42
2+
3+
[source, python]
4+
----
5+
resp = client.index(
6+
index="my_index",
7+
id="1",
8+
body={
9+
"message": "some arrays in this document...",
10+
"tags": ["elasticsearch", "wow"],
11+
"lists": [
12+
{"name": "prog_list", "description": "programming list"},
13+
{"name": "cool_list", "description": "cool stuff list"},
14+
],
15+
},
16+
)
17+
print(resp)
18+
19+
resp = client.index(
20+
index="my_index",
21+
id="2",
22+
body={
23+
"message": "no arrays in this document...",
24+
"tags": "elasticsearch",
25+
"lists": {"name": "prog_list", "description": "programming list"},
26+
},
27+
)
28+
print(resp)
29+
30+
resp = client.search(
31+
index="my_index", body={"query": {"match": {"tags": "elasticsearch"}}},
32+
)
33+
print(resp)
34+
----

docs/examples/527324766814561b75aaee853ede49a7.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:503
1+
// aggregations/bucket/terms-aggregation.asciidoc:369
22

33
[source, python]
44
----
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// query-dsl/nested-query.asciidoc:133
2+
3+
[source, python]
4+
----
5+
resp = client.indices.create(
6+
index="drivers",
7+
body={
8+
"mappings": {
9+
"properties": {
10+
"driver": {
11+
"type": "nested",
12+
"properties": {
13+
"last_name": {"type": "text"},
14+
"vehicle": {
15+
"type": "nested",
16+
"properties": {
17+
"make": {"type": "text"},
18+
"model": {"type": "text"},
19+
},
20+
},
21+
},
22+
}
23+
}
24+
}
25+
},
26+
)
27+
print(resp)
28+
----

docs/examples/58b5003c0a53a39bf509aa3797aad471.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// query-dsl/query-string-query.asciidoc:342
1+
// query-dsl/query-string-query.asciidoc:352
22

33
[source, python]
44
----

docs/examples/5d9d7b84e2fec7ecd832145cbb951cf1.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// aggregations/bucket/terms-aggregation.asciidoc:683
1+
// aggregations/bucket/terms-aggregation.asciidoc:549
22

33
[source, python]
44
----

docs/examples/5eabcdbf61bfcb484dc694f25c2bba36.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// docs/get.asciidoc:320
1+
// docs/get.asciidoc:323
22

33
[source, python]
44
----
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// indices/aliases.asciidoc:228
2+
3+
[source, python]
4+
----
5+
resp = client.indices.update_aliases(
6+
body={
7+
"actions": [
8+
{"add": {"indices": ["test1", "test2"], "alias": "alias1"}}
9+
]
10+
},
11+
)
12+
print(resp)
13+
----

docs/examples/60ee33f3acfdd0fe6f288ac77312c780.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// query-dsl/query-string-query.asciidoc:436
1+
// query-dsl/query-string-query.asciidoc:446
22

33
[source, python]
44
----
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// query-dsl/regexp-query.asciidoc:23
2+
3+
[source, python]
4+
----
5+
resp = client.search(
6+
body={
7+
"query": {
8+
"regexp": {
9+
"user": {
10+
"value": "k.*y",
11+
"flags": "ALL",
12+
"max_determinized_states": 10000,
13+
"rewrite": "constant_score",
14+
}
15+
}
16+
}
17+
},
18+
)
19+
print(resp)
20+
----
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// mapping/types/date.asciidoc:35
2+
3+
[source, python]
4+
----
5+
resp = client.indices.create(
6+
index="my_index",
7+
body={"mappings": {"properties": {"date": {"type": "date"}}}},
8+
)
9+
print(resp)
10+
11+
resp = client.index(index="my_index", id="1", body={"date": "2015-01-01"})
12+
print(resp)
13+
14+
resp = client.index(
15+
index="my_index", id="2", body={"date": "2015-01-01T12:10:30Z"},
16+
)
17+
print(resp)
18+
19+
resp = client.index(
20+
index="my_index", id="3", body={"date": 1420070400001},
21+
)
22+
print(resp)
23+
24+
resp = client.search(index="my_index", body={"sort": {"date": "asc"}})
25+
print(resp)
26+
----

0 commit comments

Comments
 (0)