diff --git a/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc b/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc new file mode 100644 index 000000000..f3ad93003 --- /dev/null +++ b/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/1605be45a5711d1929d6ad2d1ae0f797.asciidoc b/docs/examples/1605be45a5711d1929d6ad2d1ae0f797.asciidoc new file mode 100644 index 000000000..12e2cffb8 --- /dev/null +++ b/docs/examples/1605be45a5711d1929d6ad2d1ae0f797.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc b/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc new file mode 100644 index 000000000..69db46c37 --- /dev/null +++ b/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/1cd3b9d65576a9212eef898eb3105758.asciidoc b/docs/examples/1cd3b9d65576a9212eef898eb3105758.asciidoc new file mode 100644 index 000000000..f146c1b5d --- /dev/null +++ b/docs/examples/1cd3b9d65576a9212eef898eb3105758.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/2d9b30acd6b5683f39d53494c0dd779c.asciidoc b/docs/examples/2d9b30acd6b5683f39d53494c0dd779c.asciidoc new file mode 100644 index 000000000..61a35491f --- /dev/null +++ b/docs/examples/2d9b30acd6b5683f39d53494c0dd779c.asciidoc @@ -0,0 +1,10 @@ +// setup/restart-cluster.asciidoc:147 + +[source, python] +---- +resp = client.cat.health() +print(resp) + +resp = client.cat.recovery() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc b/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc new file mode 100644 index 000000000..5a50aa144 --- /dev/null +++ b/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc @@ -0,0 +1,10 @@ +// modules/indices/request_cache.asciidoc:139 + +[source, python] +---- +resp = client.indices.stats( + metric="request_cache", + human=True, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/3c5d5a5c34a62724942329658c688f5e.asciidoc b/docs/examples/3c5d5a5c34a62724942329658c688f5e.asciidoc new file mode 100644 index 000000000..1366c2005 --- /dev/null +++ b/docs/examples/3c5d5a5c34a62724942329658c688f5e.asciidoc @@ -0,0 +1,9 @@ +// setup/restart-cluster.asciidoc:162 + +[source, python] +---- +resp = client.ml.set_upgrade_mode( + enabled="false", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc b/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc new file mode 100644 index 000000000..69492fcee --- /dev/null +++ b/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc @@ -0,0 +1,10 @@ +// setup/run-elasticsearch-locally.asciidoc:125 + +[source, python] +---- +resp = client.get( + index="customer", + id="1", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc b/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc new file mode 100644 index 000000000..a0a0f679d --- /dev/null +++ b/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc b/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc new file mode 100644 index 000000000..7e4927bd4 --- /dev/null +++ b/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/45ef5156dbd2d3fd4fd22b8d99f7aad4.asciidoc b/docs/examples/45ef5156dbd2d3fd4fd22b8d99f7aad4.asciidoc new file mode 100644 index 000000000..d54c6434d --- /dev/null +++ b/docs/examples/45ef5156dbd2d3fd4fd22b8d99f7aad4.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/4e1f02928ef243bf07fd425754b7642b.asciidoc b/docs/examples/4e1f02928ef243bf07fd425754b7642b.asciidoc new file mode 100644 index 000000000..e83cf8c7f --- /dev/null +++ b/docs/examples/4e1f02928ef243bf07fd425754b7642b.asciidoc @@ -0,0 +1,6 @@ +// setup/add-nodes.asciidoc:109 + +[source, python] +---- + +---- \ No newline at end of file diff --git a/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc b/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc new file mode 100644 index 000000000..99faff82a --- /dev/null +++ b/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc b/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc new file mode 100644 index 000000000..ab71059c0 --- /dev/null +++ b/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/640a89d0b39630269433425ff476faf3.asciidoc b/docs/examples/640a89d0b39630269433425ff476faf3.asciidoc new file mode 100644 index 000000000..15fa86493 --- /dev/null +++ b/docs/examples/640a89d0b39630269433425ff476faf3.asciidoc @@ -0,0 +1,9 @@ +// upgrade/archived-settings.asciidoc:32 + +[source, python] +---- +resp = client.cluster.put_settings( + body={"persistent": {"archived.*": None}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/64ffaa6814ec1ec4f59b8f33b47cffb4.asciidoc b/docs/examples/64ffaa6814ec1ec4f59b8f33b47cffb4.asciidoc new file mode 100644 index 000000000..cad8da6c0 --- /dev/null +++ b/docs/examples/64ffaa6814ec1ec4f59b8f33b47cffb4.asciidoc @@ -0,0 +1,10 @@ +// upgrade/archived-settings.asciidoc:73 + +[source, python] +---- +resp = client.indices.put_settings( + index="my-index", + body={"archived.*": None}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc b/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc new file mode 100644 index 000000000..1aa05f241 --- /dev/null +++ b/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc @@ -0,0 +1,10 @@ +// setup/run-elasticsearch-locally.asciidoc:156 + +[source, python] +---- +resp = client.search( + index="customer", + body={"query": {"match": {"firstname": "Jennifer"}}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc b/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc new file mode 100644 index 000000000..75061a19c --- /dev/null +++ b/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc @@ -0,0 +1,10 @@ +// setup/advanced-configuration.asciidoc:124 + +[source, python] +---- +resp = client.nodes.info( + node_id="_all", + metric="jvm", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/7e49705769c42895fb7b1e2ca028ff47.asciidoc b/docs/examples/7e49705769c42895fb7b1e2ca028ff47.asciidoc new file mode 100644 index 000000000..8932ecc56 --- /dev/null +++ b/docs/examples/7e49705769c42895fb7b1e2ca028ff47.asciidoc @@ -0,0 +1,7 @@ +// setup/restart-cluster.asciidoc:219 + +[source, python] +---- +resp = client.cat.nodes() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc b/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc new file mode 100644 index 000000000..516679e8d --- /dev/null +++ b/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc b/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc new file mode 100644 index 000000000..b4515bee1 --- /dev/null +++ b/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/92f073762634a4b2274f71002494192e.asciidoc b/docs/examples/92f073762634a4b2274f71002494192e.asciidoc new file mode 100644 index 000000000..125263f38 --- /dev/null +++ b/docs/examples/92f073762634a4b2274f71002494192e.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/a21a7bf052b41f5b996dc58f7b69770f.asciidoc b/docs/examples/a21a7bf052b41f5b996dc58f7b69770f.asciidoc new file mode 100644 index 000000000..d1d61d8fe --- /dev/null +++ b/docs/examples/a21a7bf052b41f5b996dc58f7b69770f.asciidoc @@ -0,0 +1,9 @@ +// setup/restart-cluster.asciidoc:54 + +[source, python] +---- +resp = client.ml.set_upgrade_mode( + enabled="true", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc b/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc new file mode 100644 index 000000000..6ea9cee89 --- /dev/null +++ b/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc b/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc new file mode 100644 index 000000000..b6617e407 --- /dev/null +++ b/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/c0a4b0c1c6eff14da8b152ceb19c1c31.asciidoc b/docs/examples/c0a4b0c1c6eff14da8b152ceb19c1c31.asciidoc new file mode 100644 index 000000000..54b93218d --- /dev/null +++ b/docs/examples/c0a4b0c1c6eff14da8b152ceb19c1c31.asciidoc @@ -0,0 +1,10 @@ +// setup/restart-cluster.asciidoc:93 + +[source, python] +---- +resp = client.cat.health() +print(resp) + +resp = client.cat.nodes() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/c5bc577ff92f889225b0d2617adcb48c.asciidoc b/docs/examples/c5bc577ff92f889225b0d2617adcb48c.asciidoc new file mode 100644 index 000000000..7133092f3 --- /dev/null +++ b/docs/examples/c5bc577ff92f889225b0d2617adcb48c.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc b/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc new file mode 100644 index 000000000..208221877 --- /dev/null +++ b/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/cc0cca5556ec6224c7134c233734beed.asciidoc b/docs/examples/cc0cca5556ec6224c7134c233734beed.asciidoc new file mode 100644 index 000000000..51d084ee1 --- /dev/null +++ b/docs/examples/cc0cca5556ec6224c7134c233734beed.asciidoc @@ -0,0 +1,7 @@ +// modules/cluster/remote-clusters-migration.asciidoc:165 + +[source, python] +---- +resp = client.cluster.remote_info() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc b/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc new file mode 100644 index 000000000..560b5c4b0 --- /dev/null +++ b/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc @@ -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) +---- \ No newline at end of file diff --git a/docs/examples/ead4d875877d618594d0cdbdd9b7998b.asciidoc b/docs/examples/ead4d875877d618594d0cdbdd9b7998b.asciidoc new file mode 100644 index 000000000..10fff719e --- /dev/null +++ b/docs/examples/ead4d875877d618594d0cdbdd9b7998b.asciidoc @@ -0,0 +1,6 @@ +// setup/add-nodes.asciidoc:170 + +[source, python] +---- + +---- \ No newline at end of file diff --git a/docs/examples/ed250b74bc77c15bb794f55a12d762c3.asciidoc b/docs/examples/ed250b74bc77c15bb794f55a12d762c3.asciidoc new file mode 100644 index 000000000..db9e20cce --- /dev/null +++ b/docs/examples/ed250b74bc77c15bb794f55a12d762c3.asciidoc @@ -0,0 +1,9 @@ +// setup/sysconfig/swap.asciidoc:77 + +[source, python] +---- +resp = client.nodes.info( + filter_path="**.mlockall", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc b/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc new file mode 100644 index 000000000..1bbd6f4e4 --- /dev/null +++ b/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc @@ -0,0 +1,7 @@ +// setup/restart-cluster.asciidoc:189 + +[source, python] +---- +resp = client.indices.flush() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/f3c696cd63a3f042e62cbb94b75c2427.asciidoc b/docs/examples/f3c696cd63a3f042e62cbb94b75c2427.asciidoc new file mode 100644 index 000000000..c266926b1 --- /dev/null +++ b/docs/examples/f3c696cd63a3f042e62cbb94b75c2427.asciidoc @@ -0,0 +1,10 @@ +// upgrade/archived-settings.asciidoc:24 + +[source, python] +---- +resp = client.cluster.get_settings( + flat_settings="true", + filter_path="persistent.archived*", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/fde3463ddf136fdfff1306a60986515e.asciidoc b/docs/examples/fde3463ddf136fdfff1306a60986515e.asciidoc new file mode 100644 index 000000000..f0cae9445 --- /dev/null +++ b/docs/examples/fde3463ddf136fdfff1306a60986515e.asciidoc @@ -0,0 +1,11 @@ +// upgrade/archived-settings.asciidoc:64 + +[source, python] +---- +resp = client.indices.get_settings( + index="*", + flat_settings="true", + filter_path="**.settings.archived*", +) +print(resp) +---- \ No newline at end of file diff --git a/utils/generate-examples.py b/utils/generate-examples.py index eb5e9061f..869ef62cd 100644 --- a/utils/generate-examples.py +++ b/utils/generate-examples.py @@ -124,6 +124,25 @@ "ml/trained-models/apis/start-trained-model-deployment.asciidoc", "ml/trained-models/apis/stop-trained-model-deployment.asciidoc", "ml/trained-models/apis/update-trained-model-deployment.asciidoc", + "setup/run-elasticsearch-locally.asciidoc", + "setup/important-settings.asciidoc", + "setup/secure-settings.asciidoc", + "modules/cluster.asciidoc", + "modules/cluster/misc.asciidoc", + "modules/network.asciidoc", + "modules/indices/request_cache.asciidoc", + "setup/advanced-configuration.asciidoc", + "setup/sysconfig/swap.asciidoc", + "setup/sysconfig/file-descriptors.asciidoc", + "modules/discovery/voting.asciidoc", + "setup/add-nodes.asciidoc", + "setup/restart-cluster.asciidoc", + "modules/cluster/remote-clusters-api-key.asciidoc", + "modules/cluster/remote-clusters-cert.asciidoc", + "modules/discovery/voting.asciidoc", + "modules/cluster/remote-clusters-migration.asciidoc", + "modules/cluster/remote-clusters-troubleshooting.asciidoc", + "upgrade/archived-settings.asciidoc", ]