Skip to content

Commit

Permalink
adding cluster doc code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Annie Hansen authored and Annie Hansen committed Feb 24, 2024
1 parent 44c5c69 commit 2bcbf9a
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// cluster/allocation-explain.asciidoc:10

[source, python]
----
resp = client.cluster.allocation_explain(
body={
"index": "my-index-000001",
"shard": 0,
"primary": False,
"current_node": "my-node",
},
)
print(resp)
----
28 changes: 28 additions & 0 deletions docs/examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// cluster/reroute.asciidoc:195

[source, python]
----
resp = client.cluster.reroute(
metric="none",
body={
"commands": [
{
"move": {
"index": "test",
"shard": 0,
"from_node": "node1",
"to_node": "node2",
}
},
{
"allocate_replica": {
"index": "test",
"shard": 1,
"node": "node3",
}
},
]
},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// cluster/update-settings.asciidoc:123

[source, python]
----
resp = client.cluster.put_settings(
body={"transient": {"indices.recovery.*": None}},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// health/health.asciidoc:470

[source, python]
----
resp = client.health_report(
verbose="false",
)
print(resp)
----
7 changes: 7 additions & 0 deletions docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// cluster/get-settings.asciidoc:10

[source, python]
----
resp = client.cluster.get_settings()
print(resp)
----
7 changes: 7 additions & 0 deletions docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// cluster/allocation-explain.asciidoc:342

[source, python]
----
resp = client.cluster.allocation_explain()
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// health/health.asciidoc:463

[source, python]
----
resp = client.health_report(
feature="shards_availability",
)
print(resp)
----
7 changes: 7 additions & 0 deletions docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// health/health.asciidoc:455

[source, python]
----
resp = client.health_report()
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// cluster/allocation-explain.asciidoc:101

[source, python]
----
resp = client.cluster.allocation_explain(
body={"index": "my-index-000001", "shard": 0, "primary": True},
)
print(resp)
----
10 changes: 10 additions & 0 deletions docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// cluster/update-settings.asciidoc:68

[source, python]
----
resp = client.cluster.put_settings(
flat_settings="true",
body={"transient": {"indices.recovery.max_bytes_per_sec": "20mb"}},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// cluster/update-settings.asciidoc:45

[source, python]
----
resp = client.cluster.put_settings(
body={"persistent": {"indices.recovery.max_bytes_per_sec": "50mb"}},
)
print(resp)
----
9 changes: 9 additions & 0 deletions docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// cluster/update-settings.asciidoc:96

[source, python]
----
resp = client.cluster.put_settings(
body={"transient": {"indices.recovery.max_bytes_per_sec": None}},
)
print(resp)
----
5 changes: 5 additions & 0 deletions utils/generate-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
"mapping/fields/id-field.asciidoc",
"search.asciidoc",
"mapping/params/multi-fields.asciidoc",
"cluster/allocation-explain.asciidoc",
"cluster/get-settings.asciidoc",
"cluster/update-settings.asciidoc",
"health/health.asciidoc",
"cluster/reroute.asciidoc",
]


Expand Down

0 comments on commit 2bcbf9a

Please sign in to comment.