diff --git a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc index 27278ffd3..852ec4273 100644 --- a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc +++ b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:275 +// inference/put-inference.asciidoc:452 [source, python] ---- diff --git a/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc b/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc index 5831d48ab..97c6ae00b 100644 --- a/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc +++ b/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/numeric.asciidoc:275 +// mapping/types/numeric.asciidoc:287 [source, python] ---- diff --git a/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc b/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc index d4aa29269..4a4f388c8 100644 --- a/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc +++ b/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:369 +// inference/put-inference.asciidoc:559 [source, python] ---- diff --git a/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc b/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc index 5d5454084..f3d348b3e 100644 --- a/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc +++ b/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc @@ -1,4 +1,4 @@ -// inference/post-inference.asciidoc:73 +// inference/post-inference.asciidoc:197 [source, python] ---- diff --git a/docs/examples/156bc64c94f9f3334fbce25165d2286a.asciidoc b/docs/examples/156bc64c94f9f3334fbce25165d2286a.asciidoc new file mode 100644 index 000000000..52a959057 --- /dev/null +++ b/docs/examples/156bc64c94f9f3334fbce25165d2286a.asciidoc @@ -0,0 +1,15 @@ +// index-modules/index-sorting.asciidoc:16 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + body={ + "settings": { + "index": {"sort.field": "date", "sort.order": "desc"} + }, + "mappings": {"properties": {"date": {"type": "date"}}}, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/17e6f3fac556f08a78f7a876e71acb89.asciidoc b/docs/examples/17e6f3fac556f08a78f7a876e71acb89.asciidoc new file mode 100644 index 000000000..12eaf3252 --- /dev/null +++ b/docs/examples/17e6f3fac556f08a78f7a876e71acb89.asciidoc @@ -0,0 +1,12 @@ +// index-modules/allocation/delayed.asciidoc:40 + +[source, python] +---- +resp = client.indices.put_settings( + index="_all", + body={ + "settings": {"index.unassigned.node_left.delayed_timeout": "5m"} + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc b/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc deleted file mode 100644 index 69db46c37..000000000 --- a/docs/examples/197dc41c8df9629e145b3064c63b2ccc.asciidoc +++ /dev/null @@ -1,19 +0,0 @@ -// 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/1aa91d3d48140d6367b6cabca8737b8f.asciidoc b/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc index c4553e246..7bc426db3 100644 --- a/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc +++ b/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc @@ -1,4 +1,4 @@ -// docs/bulk.asciidoc:634 +// docs/bulk.asciidoc:632 [source, python] ---- diff --git a/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc new file mode 100644 index 000000000..b114a67e1 --- /dev/null +++ b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:671 + +[source, python] +---- +resp = client.inference.put_model( + task_type="text_embedding", + inference_id="azure_ai_studio_embeddings", + body={ + "service": "azureaistudio", + "service_settings": { + "api_key": "", + "target": "", + "provider": "", + "endpoint_type": "", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/2342a56279106ea643026df657bf7f88.asciidoc b/docs/examples/2342a56279106ea643026df657bf7f88.asciidoc new file mode 100644 index 000000000..79ec731bb --- /dev/null +++ b/docs/examples/2342a56279106ea643026df657bf7f88.asciidoc @@ -0,0 +1,24 @@ +// index-modules/similarity.asciidoc:22 + +[source, python] +---- +resp = client.indices.create( + index="index", + body={ + "settings": { + "index": { + "similarity": { + "my_similarity": { + "type": "DFR", + "basic_model": "g", + "after_effect": "l", + "normalization": "h2", + "normalization.h2.c": "3.0", + } + } + } + } + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc b/docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc new file mode 100644 index 000000000..3ee3eb21a --- /dev/null +++ b/docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc @@ -0,0 +1,19 @@ +// index-modules/slowlog.asciidoc:31 + +[source, python] +---- +resp = client.indices.put_settings( + index="my-index-000001", + body={ + "index.search.slowlog.threshold.query.warn": "10s", + "index.search.slowlog.threshold.query.info": "5s", + "index.search.slowlog.threshold.query.debug": "2s", + "index.search.slowlog.threshold.query.trace": "500ms", + "index.search.slowlog.threshold.fetch.warn": "1s", + "index.search.slowlog.threshold.fetch.info": "800ms", + "index.search.slowlog.threshold.fetch.debug": "500ms", + "index.search.slowlog.threshold.fetch.trace": "200ms", + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/25d40d3049e57e2bb70c2c5b88bd7b87.asciidoc b/docs/examples/25d40d3049e57e2bb70c2c5b88bd7b87.asciidoc new file mode 100644 index 000000000..8b60d5465 --- /dev/null +++ b/docs/examples/25d40d3049e57e2bb70c2c5b88bd7b87.asciidoc @@ -0,0 +1,10 @@ +// index-modules/allocation/delayed.asciidoc:95 + +[source, python] +---- +resp = client.indices.put_settings( + index="_all", + body={"settings": {"index.unassigned.node_left.delayed_timeout": "0"}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/28ac880057135e46b3b00c7f3976538c.asciidoc b/docs/examples/28ac880057135e46b3b00c7f3976538c.asciidoc new file mode 100644 index 000000000..732d01fe5 --- /dev/null +++ b/docs/examples/28ac880057135e46b3b00c7f3976538c.asciidoc @@ -0,0 +1,10 @@ +// index-modules/allocation/filtering.asciidoc:122 + +[source, python] +---- +resp = client.indices.put_settings( + index="test", + body={"index.routing.allocation.include._ip": "192.168.2.*"}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc b/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc new file mode 100644 index 000000000..084007853 --- /dev/null +++ b/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc @@ -0,0 +1,10 @@ +// index-modules/slowlog.asciidoc:149 + +[source, python] +---- +resp = client.indices.put_settings( + index="my-index-000001", + body={"index.indexing.slowlog.include.user": True}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc b/docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc index 6d040bd6d..0641456c4 100644 --- a/docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc +++ b/docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:781 +// aggregations/bucket/datehistogram-aggregation.asciidoc:782 [source, python] ---- diff --git a/docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc b/docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc new file mode 100644 index 000000000..48b222683 --- /dev/null +++ b/docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc @@ -0,0 +1,10 @@ +// index-modules/slowlog.asciidoc:66 + +[source, python] +---- +resp = client.indices.put_settings( + index="my-index-000001", + body={"index.search.slowlog.include.user": True}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc index 2c5244e74..515516945 100644 --- a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc +++ b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:478 +// health/health.asciidoc:481 [source, python] ---- diff --git a/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc b/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc index a6e093c17..1c8891952 100644 --- a/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc +++ b/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/numeric.asciidoc:247 +// mapping/types/numeric.asciidoc:259 [source, python] ---- diff --git a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc b/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc deleted file mode 100644 index 10baf038a..000000000 --- a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// getting-started.asciidoc:245 - -[source, python] ----- -resp = client.search( - index="books", - body={"query": {"match": {"name": "brave"}}}, -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc b/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc deleted file mode 100644 index 4a576819a..000000000 --- a/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc +++ /dev/null @@ -1,7 +0,0 @@ -// tab-widgets/api-call.asciidoc:13 - -[source, python] ----- -resp = client.info() -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc b/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc deleted file mode 100644 index 69492fcee..000000000 --- a/docs/examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// 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/48de51de87a8ad9fd8b8db1ca25b85c1.asciidoc b/docs/examples/48de51de87a8ad9fd8b8db1ca25b85c1.asciidoc new file mode 100644 index 000000000..f7b97ae7e --- /dev/null +++ b/docs/examples/48de51de87a8ad9fd8b8db1ca25b85c1.asciidoc @@ -0,0 +1,20 @@ +// index-modules/similarity.asciidoc:540 + +[source, python] +---- +resp = client.indices.close( + index="index", +) +print(resp) + +resp = client.indices.put_settings( + index="index", + body={"index": {"similarity": {"default": {"type": "boolean"}}}}, +) +print(resp) + +resp = client.indices.open( + index="index", +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc index 4f9dcb5a9..f2197e790 100644 --- a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc +++ b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc @@ -1,4 +1,4 @@ -// cluster/allocation-explain.asciidoc:342 +// cluster/allocation-explain.asciidoc:344 [source, python] ---- diff --git a/docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc b/docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc index c64de0814..eebe7e709 100644 --- a/docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc +++ b/docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc @@ -1,4 +1,4 @@ -// inference/delete-inference.asciidoc:53 +// inference/delete-inference.asciidoc:55 [source, python] ---- diff --git a/docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc b/docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc index c662e2685..f5af5e526 100644 --- a/docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc +++ b/docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:488 +// aggregations/bucket/datehistogram-aggregation.asciidoc:489 [source, python] ---- diff --git a/docs/examples/5203560189ccab7122c03500147701ef.asciidoc b/docs/examples/5203560189ccab7122c03500147701ef.asciidoc index 3e0285303..412284e48 100644 --- a/docs/examples/5203560189ccab7122c03500147701ef.asciidoc +++ b/docs/examples/5203560189ccab7122c03500147701ef.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:568 +// aggregations/bucket/datehistogram-aggregation.asciidoc:569 [source, python] ---- diff --git a/docs/examples/528e5f1c345c3769248cc6889e8cf552.asciidoc b/docs/examples/528e5f1c345c3769248cc6889e8cf552.asciidoc new file mode 100644 index 000000000..8e249cd55 --- /dev/null +++ b/docs/examples/528e5f1c345c3769248cc6889e8cf552.asciidoc @@ -0,0 +1,14 @@ +// index-modules/similarity.asciidoc:45 + +[source, python] +---- +resp = client.indices.put_mapping( + index="index", + body={ + "properties": { + "title": {"type": "text", "similarity": "my_similarity"} + } + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/553d79817bb1333970e99507c37a159a.asciidoc b/docs/examples/553d79817bb1333970e99507c37a159a.asciidoc new file mode 100644 index 000000000..2862caa9e --- /dev/null +++ b/docs/examples/553d79817bb1333970e99507c37a159a.asciidoc @@ -0,0 +1,14 @@ +// index-modules/similarity.asciidoc:520 + +[source, python] +---- +resp = client.indices.create( + index="index", + body={ + "settings": { + "index": {"similarity": {"default": {"type": "boolean"}}} + } + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc b/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc index 274b79804..d03933cb3 100644 --- a/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc +++ b/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:58 +// mapping/types/nested.asciidoc:60 [source, python] ---- diff --git a/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc new file mode 100644 index 000000000..695942d2e --- /dev/null +++ b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc @@ -0,0 +1,17 @@ +// inference/put-inference.asciidoc:600 + +[source, python] +---- +resp = client.inference.put_model( + task_type="completion", + inference_id="openai-completion", + body={ + "service": "openai", + "service_settings": { + "api_key": "", + "model_id": "gpt-3.5-turbo", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/5f8fb5513d4f725434db2f517ad4298f.asciidoc b/docs/examples/5f8fb5513d4f725434db2f517ad4298f.asciidoc new file mode 100644 index 000000000..730df13b0 --- /dev/null +++ b/docs/examples/5f8fb5513d4f725434db2f517ad4298f.asciidoc @@ -0,0 +1,30 @@ +// index-modules/similarity.asciidoc:357 + +[source, python] +---- +resp = client.indices.create( + index="index", + body={ + "settings": { + "number_of_shards": 1, + "similarity": { + "scripted_tfidf": { + "type": "scripted", + "weight_script": { + "source": "double idf = Math.log((field.docCount+1.0)/(term.docFreq+1.0)) + 1.0; return query.boost * idf;" + }, + "script": { + "source": "double tf = Math.sqrt(doc.freq); double norm = 1/Math.sqrt(doc.length); return weight * tf * norm;" + }, + } + }, + }, + "mappings": { + "properties": { + "field": {"type": "text", "similarity": "scripted_tfidf"} + } + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc b/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc index a685eae37..ef268ceea 100644 --- a/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc +++ b/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:85 +// mapping/types/nested.asciidoc:87 [source, python] ---- diff --git a/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc new file mode 100644 index 000000000..dcbb1f44d --- /dev/null +++ b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:689 + +[source, python] +---- +resp = client.inference.put_model( + task_type="completion", + inference_id="azure_ai_studio_completion", + body={ + "service": "azureaistudio", + "service_settings": { + "api_key": "", + "target": "", + "provider": "", + "endpoint_type": "", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc index 59c20f5d1..e3e260e2b 100644 --- a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc +++ b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc @@ -1,4 +1,4 @@ -// ml/trained-models/apis/update-trained-model-deployment.asciidoc:55 +// ml/trained-models/apis/update-trained-model-deployment.asciidoc:53 [source, python] ---- diff --git a/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc b/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc deleted file mode 100644 index 1aa05f241..000000000 --- a/docs/examples/75e229852d1404040bb2e83723c0f1db.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// 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/77b90f6787195767b6da60d8532714b4.asciidoc b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc new file mode 100644 index 000000000..38ad4091a --- /dev/null +++ b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:623 + +[source, python] +---- +resp = client.inference.put_model( + task_type="text_embedding", + inference_id="azure_openai_embeddings", + body={ + "service": "azureopenai", + "service_settings": { + "api_key": "", + "resource_name": "", + "deployment_id": "", + "api_version": "2024-02-01", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/7b3e913368e96eaa6e22e0d03c81310e.asciidoc b/docs/examples/7b3e913368e96eaa6e22e0d03c81310e.asciidoc new file mode 100644 index 000000000..2ec03ab3b --- /dev/null +++ b/docs/examples/7b3e913368e96eaa6e22e0d03c81310e.asciidoc @@ -0,0 +1,10 @@ +// index-modules/store.asciidoc:30 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + body={"settings": {"index.store.type": "hybridfs"}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc b/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc index d0ebccfa8..e060c6234 100644 --- a/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc +++ b/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:22 +// mapping/types/nested.asciidoc:24 [source, python] ---- diff --git a/docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc b/docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc new file mode 100644 index 000000000..8fca1dd38 --- /dev/null +++ b/docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc @@ -0,0 +1,16 @@ +// index-modules/slowlog.asciidoc:133 + +[source, python] +---- +resp = client.indices.put_settings( + index="my-index-000001", + body={ + "index.indexing.slowlog.threshold.index.warn": "10s", + "index.indexing.slowlog.threshold.index.info": "5s", + "index.indexing.slowlog.threshold.index.debug": "2s", + "index.indexing.slowlog.threshold.index.trace": "500ms", + "index.indexing.slowlog.source": "1000", + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc b/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc deleted file mode 100644 index cd3172de0..000000000 --- a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -// getting-started.asciidoc:65 - -[source, python] ----- -resp = client.index( - index="books", - body={ - "name": "Snow Crash", - "author": "Neal Stephenson", - "release_date": "1992-06-01", - "page_count": 470, - }, -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc new file mode 100644 index 000000000..3a2a78872 --- /dev/null +++ b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc @@ -0,0 +1,18 @@ +// inference/put-inference.asciidoc:424 + +[source, python] +---- +resp = client.inference.put_model( + task_type="rerank", + inference_id="cohere-rerank", + body={ + "service": "cohere", + "service_settings": { + "api_key": "", + "model_id": "rerank-english-v3.0", + }, + "task_settings": {"top_n": 10, "return_documents": True}, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/8703f3b1b3895543abc36e2a7a0013d3.asciidoc b/docs/examples/8703f3b1b3895543abc36e2a7a0013d3.asciidoc new file mode 100644 index 000000000..2ba414b58 --- /dev/null +++ b/docs/examples/8703f3b1b3895543abc36e2a7a0013d3.asciidoc @@ -0,0 +1,26 @@ +// index-modules/allocation/prioritization.asciidoc:17 + +[source, python] +---- +resp = client.indices.create( + index="index_1", +) +print(resp) + +resp = client.indices.create( + index="index_2", +) +print(resp) + +resp = client.indices.create( + index="index_3", + body={"settings": {"index.priority": 10}}, +) +print(resp) + +resp = client.indices.create( + index="index_4", + body={"settings": {"index.priority": 5}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc index 63e252c69..e323188a2 100644 --- a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc +++ b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:471 +// health/health.asciidoc:474 [source, python] ---- diff --git a/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc b/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc index 639a269cc..452631e77 100644 --- a/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc +++ b/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc @@ -1,4 +1,4 @@ -// docs/bulk.asciidoc:612 +// docs/bulk.asciidoc:610 [source, python] ---- diff --git a/docs/examples/8d7193902a353872740a3324c60c5001.asciidoc b/docs/examples/8d7193902a353872740a3324c60c5001.asciidoc new file mode 100644 index 000000000..2fc9ec900 --- /dev/null +++ b/docs/examples/8d7193902a353872740a3324c60c5001.asciidoc @@ -0,0 +1,15 @@ +// index-modules/index-sorting.asciidoc:114 + +[source, python] +---- +resp = client.indices.create( + index="events", + body={ + "settings": { + "index": {"sort.field": "timestamp", "sort.order": "desc"} + }, + "mappings": {"properties": {"timestamp": {"type": "date"}}}, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc b/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc deleted file mode 100644 index 516679e8d..000000000 --- a/docs/examples/90112d594b934c0111b7303b9f91cb7f.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -// 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/9a02bd47c000a3d9a8911233c37c890f.asciidoc b/docs/examples/9a02bd47c000a3d9a8911233c37c890f.asciidoc index fd12e4bd9..d6793b366 100644 --- a/docs/examples/9a02bd47c000a3d9a8911233c37c890f.asciidoc +++ b/docs/examples/9a02bd47c000a3d9a8911233c37c890f.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:366 +// aggregations/bucket/datehistogram-aggregation.asciidoc:367 [source, python] ---- diff --git a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc index 6b6a5531b..6358786d3 100644 --- a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc +++ b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:253 +// inference/put-inference.asciidoc:406 [source, python] ---- diff --git a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc index 68c134d0a..c144209d1 100644 --- a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc +++ b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:463 +// health/health.asciidoc:466 [source, python] ---- diff --git a/docs/examples/9de4ea9d5f3d427a71ee07d998cb5611.asciidoc b/docs/examples/9de4ea9d5f3d427a71ee07d998cb5611.asciidoc new file mode 100644 index 000000000..71e071724 --- /dev/null +++ b/docs/examples/9de4ea9d5f3d427a71ee07d998cb5611.asciidoc @@ -0,0 +1,6 @@ +// index-modules/blocks.asciidoc:138 + +[source, python] +---- + +---- \ No newline at end of file diff --git a/docs/examples/6dda348069f89ffb2379b3a281a24cc9.asciidoc b/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc similarity index 77% rename from docs/examples/6dda348069f89ffb2379b3a281a24cc9.asciidoc rename to docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc index fd9eda50d..1da3cf8d8 100644 --- a/docs/examples/6dda348069f89ffb2379b3a281a24cc9.asciidoc +++ b/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc @@ -1,10 +1,10 @@ -// inference/put-inference.asciidoc:394 +// inference/put-inference.asciidoc:584 [source, python] ---- resp = client.inference.put_model( task_type="text_embedding", - inference_id="openai_embeddings", + inference_id="openai-embeddings", body={ "service": "openai", "service_settings": { diff --git a/docs/examples/a38f29375eabd0103f8d7c00b17bb0ab.asciidoc b/docs/examples/a38f29375eabd0103f8d7c00b17bb0ab.asciidoc new file mode 100644 index 000000000..e1993c2d3 --- /dev/null +++ b/docs/examples/a38f29375eabd0103f8d7c00b17bb0ab.asciidoc @@ -0,0 +1,7 @@ +// index-modules/allocation/delayed.asciidoc:82 + +[source, python] +---- +resp = client.cluster.health() +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/a425fcab60f603504becee7d001f0a4b.asciidoc b/docs/examples/a425fcab60f603504becee7d001f0a4b.asciidoc new file mode 100644 index 000000000..b027e718f --- /dev/null +++ b/docs/examples/a425fcab60f603504becee7d001f0a4b.asciidoc @@ -0,0 +1,10 @@ +// index-modules/allocation/prioritization.asciidoc:48 + +[source, python] +---- +resp = client.indices.put_settings( + index="index_4", + body={"index.priority": 1}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc b/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc index 79b43f6c1..5f21ffc5e 100644 --- a/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc +++ b/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc @@ -1,4 +1,4 @@ -// inference/get-inference.asciidoc:69 +// inference/get-inference.asciidoc:73 [source, python] ---- diff --git a/docs/examples/a84ffbaa4ffa68b22f6fe42d3b4f8dd5.asciidoc b/docs/examples/a84ffbaa4ffa68b22f6fe42d3b4f8dd5.asciidoc index 2bcfac3ae..37789b6fd 100644 --- a/docs/examples/a84ffbaa4ffa68b22f6fe42d3b4f8dd5.asciidoc +++ b/docs/examples/a84ffbaa4ffa68b22f6fe42d3b4f8dd5.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:588 +// aggregations/bucket/datehistogram-aggregation.asciidoc:589 [source, python] ---- diff --git a/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc b/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc index 72d9604b9..668510e72 100644 --- a/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc +++ b/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc @@ -1,4 +1,4 @@ -// docs/bulk.asciidoc:501 +// docs/bulk.asciidoc:499 [source, python] ---- diff --git a/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc b/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc index 6ea9cee89..0ca0ece51 100644 --- a/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc +++ b/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc @@ -1,4 +1,4 @@ -// setup/secure-settings.asciidoc:35 +// setup/secure-settings.asciidoc:39 [source, python] ---- diff --git a/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc b/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc new file mode 100644 index 000000000..8a1fc3fc3 --- /dev/null +++ b/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc @@ -0,0 +1,11 @@ +// inference/post-inference.asciidoc:102 + +[source, python] +---- +resp = client.inference.inference( + task_type="completion", + inference_id="openai_chat_completions", + body={"input": "What is Elastic?"}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/ba59a3b9a0a2694704b2bf9c6ad4a8cf.asciidoc b/docs/examples/ba59a3b9a0a2694704b2bf9c6ad4a8cf.asciidoc index 77b897af5..8622ad4b6 100644 --- a/docs/examples/ba59a3b9a0a2694704b2bf9c6ad4a8cf.asciidoc +++ b/docs/examples/ba59a3b9a0a2694704b2bf9c6ad4a8cf.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:610 +// aggregations/bucket/datehistogram-aggregation.asciidoc:611 [source, python] ---- diff --git a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc b/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc deleted file mode 100644 index bfbc6a0e8..000000000 --- a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc +++ /dev/null @@ -1,9 +0,0 @@ -// getting-started.asciidoc:228 - -[source, python] ----- -resp = client.search( - index="books", -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/beba2a9795c8a13653e1edf64eec4357.asciidoc b/docs/examples/beba2a9795c8a13653e1edf64eec4357.asciidoc new file mode 100644 index 000000000..aafc40145 --- /dev/null +++ b/docs/examples/beba2a9795c8a13653e1edf64eec4357.asciidoc @@ -0,0 +1,13 @@ +// index-modules/allocation/filtering.asciidoc:74 + +[source, python] +---- +resp = client.indices.put_settings( + index="test", + body={ + "index.routing.allocation.require.size": "big", + "index.routing.allocation.require.rack": "rack1", + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc b/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc index c1d524d1c..7d843b759 100644 --- a/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc +++ b/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc @@ -1,4 +1,4 @@ -// docs/bulk.asciidoc:713 +// docs/bulk.asciidoc:711 [source, python] ---- diff --git a/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc b/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc index a0950395e..f205a86e4 100644 --- a/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc +++ b/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc @@ -1,4 +1,4 @@ -// docs/bulk.asciidoc:766 +// docs/bulk.asciidoc:764 [source, python] ---- diff --git a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc index c9e868528..c1628c21e 100644 --- a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc +++ b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:300 +// inference/put-inference.asciidoc:477 [source, python] ---- diff --git a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc b/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc deleted file mode 100644 index 6fe42c6b9..000000000 --- a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc +++ /dev/null @@ -1,45 +0,0 @@ -// getting-started.asciidoc:104 - -[source, python] ----- -resp = client.bulk( - body=[ - {"index": {"_index": "books"}}, - { - "name": "Revelation Space", - "author": "Alastair Reynolds", - "release_date": "2000-03-15", - "page_count": 585, - }, - {"index": {"_index": "books"}}, - { - "name": "1984", - "author": "George Orwell", - "release_date": "1985-06-01", - "page_count": 328, - }, - {"index": {"_index": "books"}}, - { - "name": "Fahrenheit 451", - "author": "Ray Bradbury", - "release_date": "1953-10-15", - "page_count": 227, - }, - {"index": {"_index": "books"}}, - { - "name": "Brave New World", - "author": "Aldous Huxley", - "release_date": "1932-06-01", - "page_count": 268, - }, - {"index": {"_index": "books"}}, - { - "name": "The Handmaids Tale", - "author": "Margaret Atwood", - "release_date": "1985-06-01", - "page_count": 311, - }, - ], -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/d4fb482a51d67a1af48e429af6019a46.asciidoc b/docs/examples/d4fb482a51d67a1af48e429af6019a46.asciidoc new file mode 100644 index 000000000..7f15db1db --- /dev/null +++ b/docs/examples/d4fb482a51d67a1af48e429af6019a46.asciidoc @@ -0,0 +1,23 @@ +// index-modules/index-sorting.asciidoc:41 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + body={ + "settings": { + "index": { + "sort.field": ["username", "date"], + "sort.order": ["asc", "desc"], + } + }, + "mappings": { + "properties": { + "username": {"type": "keyword", "doc_values": True}, + "date": {"type": "date"}, + } + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc b/docs/examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc index 99cd507e8..5fe27c39e 100644 --- a/docs/examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc +++ b/docs/examples/da3cecc36a7313385d32c7f52ccfb7e3.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:815 +// aggregations/bucket/datehistogram-aggregation.asciidoc:816 [source, python] ---- diff --git a/docs/examples/dad2d4add751fde5c39475ca709cc14b.asciidoc b/docs/examples/dad2d4add751fde5c39475ca709cc14b.asciidoc new file mode 100644 index 000000000..a78af005f --- /dev/null +++ b/docs/examples/dad2d4add751fde5c39475ca709cc14b.asciidoc @@ -0,0 +1,10 @@ +// index-modules/allocation/filtering.asciidoc:54 + +[source, python] +---- +resp = client.indices.put_settings( + index="test", + body={"index.routing.allocation.include.size": "big,medium"}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/dfa16b7300d225e013f23625f44c087b.asciidoc b/docs/examples/dfa16b7300d225e013f23625f44c087b.asciidoc new file mode 100644 index 000000000..e31713951 --- /dev/null +++ b/docs/examples/dfa16b7300d225e013f23625f44c087b.asciidoc @@ -0,0 +1,57 @@ +// index-modules/similarity.asciidoc:192 + +[source, python] +---- +resp = client.indices.create( + index="index", + body={ + "settings": { + "number_of_shards": 1, + "similarity": { + "scripted_tfidf": { + "type": "scripted", + "script": { + "source": "double tf = Math.sqrt(doc.freq); double idf = Math.log((field.docCount+1.0)/(term.docFreq+1.0)) + 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;" + }, + } + }, + }, + "mappings": { + "properties": { + "field": {"type": "text", "similarity": "scripted_tfidf"} + } + }, + }, +) +print(resp) + +resp = client.index( + index="index", + id="1", + body={"field": "foo bar foo"}, +) +print(resp) + +resp = client.index( + index="index", + id="2", + body={"field": "bar baz"}, +) +print(resp) + +resp = client.indices.refresh( + index="index", +) +print(resp) + +resp = client.search( + index="index", + explain="true", + body={ + "query": { + "query_string": {"query": "foo^1.7", "default_field": "field"} + } + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/e1f6ea7c0937cf7e6ea7e8209e52e8bb.asciidoc b/docs/examples/e1f6ea7c0937cf7e6ea7e8209e52e8bb.asciidoc new file mode 100644 index 000000000..d39392331 --- /dev/null +++ b/docs/examples/e1f6ea7c0937cf7e6ea7e8209e52e8bb.asciidoc @@ -0,0 +1,14 @@ +// index-modules/index-sorting.asciidoc:159 + +[source, python] +---- +resp = client.search( + index="events", + body={ + "size": 10, + "sort": [{"timestamp": "desc"}], + "track_total_hits": False, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/e3b3a8ae12ab947ad3ba96eb228402ca.asciidoc b/docs/examples/e3b3a8ae12ab947ad3ba96eb228402ca.asciidoc new file mode 100644 index 000000000..a6fb60b56 --- /dev/null +++ b/docs/examples/e3b3a8ae12ab947ad3ba96eb228402ca.asciidoc @@ -0,0 +1,10 @@ +// index-modules/store.asciidoc:122 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + body={"settings": {"index.store.preload": ["nvd", "dvd"]}}, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc b/docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc index 8dac1cb20..a90bb7bfc 100644 --- a/docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc +++ b/docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:417 +// aggregations/bucket/datehistogram-aggregation.asciidoc:418 [source, python] ---- diff --git a/docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc b/docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc index 415bcd506..483bfbae0 100644 --- a/docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc +++ b/docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:642 +// aggregations/bucket/datehistogram-aggregation.asciidoc:643 [source, python] ---- diff --git a/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc b/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc index 659204a42..12c64a679 100644 --- a/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc +++ b/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc @@ -1,4 +1,4 @@ -// search/search.asciidoc:956 +// search/search.asciidoc:907 [source, python] ---- diff --git a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc index 3c44c5a60..90444ee2a 100644 --- a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc +++ b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:339 +// inference/put-inference.asciidoc:516 [source, python] ---- diff --git a/docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc b/docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc index 27719ab27..ea871d67d 100644 --- a/docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc +++ b/docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc @@ -1,4 +1,4 @@ -// aggregations/bucket/datehistogram-aggregation.asciidoc:698 +// aggregations/bucket/datehistogram-aggregation.asciidoc:699 [source, python] ---- diff --git a/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc b/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc new file mode 100644 index 000000000..89cd690dc --- /dev/null +++ b/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc @@ -0,0 +1,14 @@ +// inference/post-inference.asciidoc:133 + +[source, python] +---- +resp = client.inference.inference( + task_type="rerank", + inference_id="cohere_rerank", + body={ + "input": ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"], + "query": "star wars main character", + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc new file mode 100644 index 000000000..79e082f07 --- /dev/null +++ b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:641 + +[source, python] +---- +resp = client.inference.put_model( + task_type="completion", + inference_id="azure_openai_completion", + body={ + "service": "azureopenai", + "service_settings": { + "api_key": "", + "resource_name": "", + "deployment_id": "", + "api_version": "2024-02-01", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/fc8a426f8a5112e61e2acb913982a8d9.asciidoc b/docs/examples/fc8a426f8a5112e61e2acb913982a8d9.asciidoc new file mode 100644 index 000000000..220080946 --- /dev/null +++ b/docs/examples/fc8a426f8a5112e61e2acb913982a8d9.asciidoc @@ -0,0 +1,10 @@ +// index-modules/index-sorting.asciidoc:138 + +[source, python] +---- +resp = client.search( + index="events", + body={"size": 10, "sort": [{"timestamp": "desc"}]}, +) +print(resp) +---- \ No newline at end of file diff --git a/utils/generate-examples.py b/utils/generate-examples.py index 869ef62cd..12a69f15a 100644 --- a/utils/generate-examples.py +++ b/utils/generate-examples.py @@ -143,6 +143,17 @@ "modules/cluster/remote-clusters-migration.asciidoc", "modules/cluster/remote-clusters-troubleshooting.asciidoc", "upgrade/archived-settings.asciidoc", + "index-modules/allocation/filtering.asciidoc", + "index-modules/allocation/delayed.asciidoc", + "index-modules/allocation/prioritization.asciidoc", + "index-modules/allocation/total_shards.asciidoc", + "index-modules/allocation/data_tier_allocation.asciidoc", + "index-modules/blocks.asciidoc", + "index-modules/similarity.asciidoc", + "index-modules/slowlog.asciidoc", + "index-modules/store.asciidoc", + "index-modules/index-sorting.asciidoc", + "index-modules/indexing-pressure.asciidoc", ]