Skip to content

Commit

Permalink
setup and update code examples (#2535)
Browse files Browse the repository at this point in the history
* setup and update code examples

* adding generate-examples.py changes

* removing space generate-examples.py

* Fix formatting

---------

Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
(cherry picked from commit f32878e)
  • Loading branch information
anniegale9538 authored and github-actions[bot] committed May 3, 2024
1 parent dab4d07 commit 260fce2
Show file tree
Hide file tree
Showing 36 changed files with 376 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// modules/cluster/remote-clusters-migration.asciidoc:132

[source, python]
----
resp = client.cluster.put_settings(
body={
"persistent": {
"cluster": {
"remote": {
"my_remote": {
"mode": "proxy",
"proxy_address": "my.remote.cluster.com:9443",
}
}
}
}
},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/1605be45a5711d1929d6ad2d1ae0f797.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// modules/discovery/voting.asciidoc:26

[source, python]
----
resp = client.cluster.state(
filter_path="metadata.cluster_coordination.last_committed_config",
)
print(resp)
----
19 changes: 19 additions & 0 deletions docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// setup/run-elasticsearch-locally.asciidoc:135

[source, python]
----
resp = client.bulk(
index="customer",
body=[
{"create": {}},
{"firstname": "Monica", "lastname": "Rambeau"},
{"create": {}},
{"firstname": "Carol", "lastname": "Danvers"},
{"create": {}},
{"firstname": "Wanda", "lastname": "Maximoff"},
{"create": {}},
{"firstname": "Jennifer", "lastname": "Takeda"},
],
)
print(resp)
----
11 changes: 11 additions & 0 deletions docs/examples/1cd3b9d65576a9212eef898eb3105758.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// setup/restart-cluster.asciidoc:35

[source, python]
----
resp = client.cluster.put_settings(
body={
"persistent": {"cluster.routing.allocation.enable": "primaries"}
},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/2d9b30acd6b5683f39d53494c0dd779c.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/restart-cluster.asciidoc:147

[source, python]
----
resp = client.cat.health()
print(resp)
resp = client.cat.recovery()
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// modules/indices/request_cache.asciidoc:139

[source, python]
----
resp = client.indices.stats(
metric="request_cache",
human=True,
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/3c5d5a5c34a62724942329658c688f5e.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/restart-cluster.asciidoc:162

[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled="false",
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/run-elasticsearch-locally.asciidoc:125

[source, python]
----
resp = client.get(
index="customer",
id="1",
)
print(resp)
----
13 changes: 13 additions & 0 deletions docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// modules/cluster/misc.asciidoc:133

[source, python]
----
resp = client.cluster.put_settings(
body={
"persistent": {
"cluster.metadata.administrator": "sysadmin@example.com"
}
},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// modules/indices/request_cache.asciidoc:59

[source, python]
----
resp = client.indices.create(
index="my-index-000001",
body={"settings": {"index.requests.cache.enable": False}},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/45ef5156dbd2d3fd4fd22b8d99f7aad4.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/restart-cluster.asciidoc:233

[source, python]
----
resp = client.cluster.put_settings(
body={"persistent": {"cluster.routing.allocation.enable": None}},
)
print(resp)
----
6 changes: 6 additions & 0 deletions docs/examples/4e1f02928ef243bf07fd425754b7642b.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// setup/add-nodes.asciidoc:109

[source, python]
----
----
13 changes: 13 additions & 0 deletions docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// modules/cluster/misc.asciidoc:179

[source, python]
----
resp = client.cluster.put_settings(
body={
"persistent": {
"logger.org.elasticsearch.indices.recovery": "DEBUG"
}
},
)
print(resp)
----
14 changes: 14 additions & 0 deletions docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// modules/indices/request_cache.asciidoc:86

[source, python]
----
resp = client.search(
index="my-index-000001",
request_cache="true",
body={
"size": 0,
"aggs": {"popular_colors": {"terms": {"field": "colors"}}},
},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/640a89d0b39630269433425ff476faf3.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// upgrade/archived-settings.asciidoc:32

[source, python]
----
resp = client.cluster.put_settings(
body={"persistent": {"archived.*": None}},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/64ffaa6814ec1ec4f59b8f33b47cffb4.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// upgrade/archived-settings.asciidoc:73

[source, python]
----
resp = client.indices.put_settings(
index="my-index",
body={"archived.*": None},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/run-elasticsearch-locally.asciidoc:156

[source, python]
----
resp = client.search(
index="customer",
body={"query": {"match": {"firstname": "Jennifer"}}},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/advanced-configuration.asciidoc:124

[source, python]
----
resp = client.nodes.info(
node_id="_all",
metric="jvm",
)
print(resp)
----
7 changes: 7 additions & 0 deletions docs/examples/7e49705769c42895fb7b1e2ca028ff47.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// setup/restart-cluster.asciidoc:219

[source, python]
----
resp = client.cat.nodes()
print(resp)
----
11 changes: 11 additions & 0 deletions docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// setup/run-elasticsearch-locally.asciidoc:109

[source, python]
----
resp = client.index(
index="customer",
id="1",
body={"firstname": "Jennifer", "lastname": "Walters"},
)
print(resp)
----
11 changes: 11 additions & 0 deletions docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// modules/indices/request_cache.asciidoc:146

[source, python]
----
resp = client.nodes.stats(
metric="indices",
index_metric="request_cache",
human=True,
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/92f073762634a4b2274f71002494192e.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/add-nodes.asciidoc:152

[source, python]
----
resp = client.cluster.state(
filter_path="metadata.cluster_coordination.voting_config_exclusions",
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/a21a7bf052b41f5b996dc58f7b69770f.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/restart-cluster.asciidoc:54

[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled="true",
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/secure-settings.asciidoc:35

[source, python]
----
resp = client.nodes.reload_secure_settings(
body={"secure_settings_password": "keystore-password"},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// modules/cluster/remote-clusters-migration.asciidoc:96

[source, python]
----
resp = client.cluster.get_settings(
filter_path="persistent.cluster.remote",
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/c0a4b0c1c6eff14da8b152ceb19c1c31.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/restart-cluster.asciidoc:93

[source, python]
----
resp = client.cat.health()
print(resp)
resp = client.cat.nodes()
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/c5bc577ff92f889225b0d2617adcb48c.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// setup/sysconfig/file-descriptors.asciidoc:29

[source, python]
----
resp = client.nodes.stats(
metric="process",
filter_path="**.max_file_descriptors",
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// modules/indices/request_cache.asciidoc:47

[source, python]
----
resp = client.indices.clear_cache(
index=["my-index-000001", "my-index-000002"],
request="true",
)
print(resp)
----
7 changes: 7 additions & 0 deletions docs/examples/cc0cca5556ec6224c7134c233734beed.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// modules/cluster/remote-clusters-migration.asciidoc:165

[source, python]
----
resp = client.cluster.remote_info()
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// modules/indices/request_cache.asciidoc:72

[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
body={"index.requests.cache.enable": True},
)
print(resp)
----
6 changes: 6 additions & 0 deletions docs/examples/ead4d875877d618594d0cdbdd9b7998b.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// setup/add-nodes.asciidoc:170

[source, python]
----
----
9 changes: 9 additions & 0 deletions docs/examples/ed250b74bc77c15bb794f55a12d762c3.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// setup/sysconfig/swap.asciidoc:77

[source, python]
----
resp = client.nodes.info(
filter_path="**.mlockall",
)
print(resp)
----

0 comments on commit 260fce2

Please sign in to comment.