Skip to content

Commit

Permalink
Update generated examples (#2312)
Browse files Browse the repository at this point in the history
* Fix example generation

* Stop using mktemp

It is insecure, though not in this specific context, but tools are
flagging this.
  • Loading branch information
pquentin authored Oct 2, 2023
1 parent 3f232f1 commit 65e0ea6
Show file tree
Hide file tree
Showing 450 changed files with 1,946 additions and 2,437 deletions.
13 changes: 0 additions & 13 deletions docs/examples/014b788c879e4aaa1020672e45e25473.asciidoc

This file was deleted.

15 changes: 15 additions & 0 deletions docs/examples/0163af36c8472ac0c5160c8b716f5b26.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// aggregations/bucket/filter-aggregation.asciidoc:58

[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
body={
"query": {"term": {"type": "t-shirt"}},
"aggs": {"avg_price": {"avg": {"field": "price"}}},
},
)
print(resp)
----
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// indices/put-mapping.asciidoc:166
// indices/put-mapping.asciidoc:177

[source, python]
----
resp = client.indices.put_mapping(
index="my_index",
index="my-index-000001",
body={
"properties": {"name": {"properties": {"last": {"type": "text"}}}}
},
Expand Down
9 changes: 0 additions & 9 deletions docs/examples/025b54db0edc50c24ea48a2bd94366ad.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// aggregations/bucket/terms-aggregation.asciidoc:520
// aggregations/bucket/terms-aggregation.asciidoc:571

[source, python]
----
Expand Down
11 changes: 11 additions & 0 deletions docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// docs/get.asciidoc:79

[source, python]
----
resp = client.get(
index="my-index-000001",
id="0",
_source="*.id",
)
print(resp)
----
20 changes: 0 additions & 20 deletions docs/examples/033778305d52746f5ce0a2a922c8e521.asciidoc

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/047266b0d20fdb62ebc72d51952c8f6d.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// query-dsl/multi-match-query.asciidoc:341
// query-dsl/multi-match-query.asciidoc:344

[source, python]
----
Expand Down
15 changes: 0 additions & 15 deletions docs/examples/048d8abd42d094bbdcf4452a58ccb35b.asciidoc

This file was deleted.

7 changes: 5 additions & 2 deletions docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// cluster/health.asciidoc:35
// cluster/health.asciidoc:42

[source, python]
----
resp = client.cluster.health(wait_for_status="yellow", timeout="50s")
resp = client.cluster.health(
wait_for_status="yellow",
timeout="50s",
)
print(resp)
----
22 changes: 0 additions & 22 deletions docs/examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc

This file was deleted.

7 changes: 0 additions & 7 deletions docs/examples/073539a7e38be3cdf13008330b6a536a.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// docs/reindex.asciidoc:815
// docs/reindex.asciidoc:878

[source, python]
----
resp = client.reindex(
body={
"max_docs": 10,
"source": {
"index": "twitter",
"index": "my-index-000001",
"query": {
"function_score": {"random_score": {}, "min_score": 0.9}
},
},
"dest": {"index": "random_twitter"},
"dest": {"index": "my-new-index-000001"},
},
)
print(resp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// aggregations/bucket/datehistogram-aggregation.asciidoc:214
// aggregations/bucket/datehistogram-aggregation.asciidoc:198

[source, python]
----
Expand Down
14 changes: 0 additions & 14 deletions docs/examples/0989cc65d8924f666ce3eb0820d2d244.asciidoc

This file was deleted.

10 changes: 0 additions & 10 deletions docs/examples/09cdd5ae8114c49886026fef8d00a19c.asciidoc

This file was deleted.

4 changes: 3 additions & 1 deletion docs/examples/09d617863a103c82fb4101e6165ea7fe.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[source, python]
----
resp = client.search(body={"query": {"match_all": {}}})
resp = client.search(
body={"query": {"match_all": {}}},
)
print(resp)
----
10 changes: 0 additions & 10 deletions docs/examples/09dbd90c5e22ea4a17b4cf9aa72e08ae.asciidoc

This file was deleted.

12 changes: 0 additions & 12 deletions docs/examples/0ba0b2db24852abccb7c0fc1098d566e.asciidoc

This file was deleted.

9 changes: 0 additions & 9 deletions docs/examples/0be2c28ee65384774b1e479b47dc3d92.asciidoc

This file was deleted.

13 changes: 0 additions & 13 deletions docs/examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc

This file was deleted.

11 changes: 11 additions & 0 deletions docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// docs/delete.asciidoc:82

[source, python]
----
resp = client.delete(
index="my-index-000001",
id="1",
routing="shard-1",
)
print(resp)
----
12 changes: 0 additions & 12 deletions docs/examples/0cc991e3f7f8511a34730e154b3c5edc.asciidoc

This file was deleted.

9 changes: 0 additions & 9 deletions docs/examples/0ce3606f1dba490eef83c4317b315b62.asciidoc

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/0e118857b815b62118a30c042f079db1.asciidoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// query-dsl/multi-match-query.asciidoc:259
// query-dsl/multi-match-query.asciidoc:262

[source, python]
----
Expand Down
23 changes: 23 additions & 0 deletions docs/examples/0e3b4a48a3450cd99c95ec46d4701b58.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// aggregations/bucket/filter-aggregation.asciidoc:167

[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
body={
"aggs": {
"hats": {
"filter": {"term": {"type": "hat"}},
"aggs": {"avg_price": {"avg": {"field": "price"}}},
},
"t_shirts": {
"filter": {"term": {"type": "t-shirt"}},
"aggs": {"avg_price": {"avg": {"field": "price"}}},
},
}
},
)
print(resp)
----
24 changes: 24 additions & 0 deletions docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// mapping/types/numeric.asciidoc:275

[source, python]
----
resp = client.indices.create(
index="idx",
body={
"mappings": {
"_source": {"mode": "synthetic"},
"properties": {
"f": {"type": "scaled_float", "scaling_factor": 0.01}
},
}
},
)
print(resp)
resp = client.index(
index="idx",
id="1",
body={"f": 123},
)
print(resp)
----
Loading

0 comments on commit 65e0ea6

Please sign in to comment.