|
1380 | 1380 | "specification/cluster/put_component_template/examples/request/ClusterPutComponentTemplateRequestExample2.yaml": [ |
1381 | 1381 | { |
1382 | 1382 | "language": "Python", |
1383 | | - "code": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template=None,\n settings={\n \"number_of_shards\": 1\n },\n aliases={\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n },\n)" |
| 1383 | + "code": "resp = client.cluster.put_component_template(\n name=\"template_1\",\n template={\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n },\n)" |
1384 | 1384 | }, |
1385 | 1385 | { |
1386 | 1386 | "language": "JavaScript", |
1387 | | - "code": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: null,\n settings: {\n number_of_shards: 1,\n },\n aliases: {\n alias1: {},\n alias2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n \"{index}-alias\": {},\n },\n});" |
| 1387 | + "code": "const response = await client.cluster.putComponentTemplate({\n name: \"template_1\",\n template: {\n settings: {\n number_of_shards: 1,\n },\n aliases: {\n alias1: {},\n alias2: {\n filter: {\n term: {\n \"user.id\": \"kimchy\",\n },\n },\n routing: \"shard-1\",\n },\n \"{index}-alias\": {},\n },\n },\n});" |
1388 | 1388 | }, |
1389 | 1389 | { |
1390 | 1390 | "language": "Ruby", |
1391 | | - "code": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": nil,\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n }\n)" |
| 1391 | + "code": "response = client.cluster.put_component_template(\n name: \"template_1\",\n body: {\n \"template\": {\n \"settings\": {\n \"number_of_shards\": 1\n },\n \"aliases\": {\n \"alias1\": {},\n \"alias2\": {\n \"filter\": {\n \"term\": {\n \"user.id\": \"kimchy\"\n }\n },\n \"routing\": \"shard-1\"\n },\n \"{index}-alias\": {}\n }\n }\n }\n)" |
1392 | 1392 | }, |
1393 | 1393 | { |
1394 | 1394 | "language": "PHP", |
1395 | | - "code": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => null,\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"aliases\" => [\n \"alias1\" => new ArrayObject([]),\n \"alias2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n \"{index}-alias\" => new ArrayObject([]),\n ],\n ],\n]);" |
| 1395 | + "code": "$resp = $client->cluster()->putComponentTemplate([\n \"name\" => \"template_1\",\n \"body\" => [\n \"template\" => [\n \"settings\" => [\n \"number_of_shards\" => 1,\n ],\n \"aliases\" => [\n \"alias1\" => new ArrayObject([]),\n \"alias2\" => [\n \"filter\" => [\n \"term\" => [\n \"user.id\" => \"kimchy\",\n ],\n ],\n \"routing\" => \"shard-1\",\n ],\n \"{index}-alias\" => new ArrayObject([]),\n ],\n ],\n ],\n]);" |
1396 | 1396 | }, |
1397 | 1397 | { |
1398 | 1398 | "language": "curl", |
1399 | | - "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":null,\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" |
| 1399 | + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"template\":{\"settings\":{\"number_of_shards\":1},\"aliases\":{\"alias1\":{},\"alias2\":{\"filter\":{\"term\":{\"user.id\":\"kimchy\"}},\"routing\":\"shard-1\"},\"{index}-alias\":{}}}}' \"$ELASTICSEARCH_URL/_component_template/template_1\"" |
| 1400 | + }, |
| 1401 | + { |
| 1402 | + "language": "Java", |
| 1403 | + "code": "client.cluster().putComponentTemplate(p -> p\n .name(\"template_1\")\n .template(t -> t\n .aliases(Map.of(\"alias1\", Alias.of(a -> a),\"{index}-alias\", Alias.of(a -> a),\"alias2\", Alias.of(a -> a\n .filter(f -> f\n .term(te -> te\n .field(\"user.id\")\n .value(FieldValue.of(\"kimchy\"))\n )\n )\n .routing(\"shard-1\")\n )))\n .settings(s -> s\n .numberOfShards(\"1\")\n )\n )\n);\n" |
1400 | 1404 | } |
1401 | 1405 | ], |
1402 | 1406 | "specification/cluster/get_settings/examples/request/ClusterGetSettingsExample1.yaml": [ |
|
1422 | 1426 | }, |
1423 | 1427 | { |
1424 | 1428 | "language": "Java", |
1425 | | - "code": "\n" |
| 1429 | + "code": "client.cluster().getSettings(g -> g);\n" |
1426 | 1430 | } |
1427 | 1431 | ], |
1428 | 1432 | "specification/cluster/reroute/examples/request/ClusterRerouteRequestExample1.yaml": [ |
|
1445 | 1449 | { |
1446 | 1450 | "language": "curl", |
1447 | 1451 | "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"commands\":[{\"move\":{\"index\":\"test\",\"shard\":0,\"from_node\":\"node1\",\"to_node\":\"node2\"}},{\"allocate_replica\":{\"index\":\"test\",\"shard\":1,\"node\":\"node3\"}}]}' \"$ELASTICSEARCH_URL/_cluster/reroute?metric=none\"" |
| 1452 | + }, |
| 1453 | + { |
| 1454 | + "language": "Java", |
| 1455 | + "code": "client.cluster().reroute(r -> r\n .commands(List.of(Command.of(c -> c\n .move(m -> m\n .index(\"test\")\n .shard(0)\n .fromNode(\"node1\")\n .toNode(\"node2\")\n )\n ),Command.of(c -> c\n .allocateReplica(a -> a\n .index(\"test\")\n .shard(1)\n .node(\"node3\")\n )\n )))\n .metric(\"none\")\n);\n" |
1448 | 1456 | } |
1449 | 1457 | ], |
1450 | 1458 | "specification/cluster/allocation_explain/examples/request/ClusterAllocationExplainRequestExample1.yaml": [ |
|
1574 | 1582 | }, |
1575 | 1583 | { |
1576 | 1584 | "language": "Java", |
1577 | | - "code": "\n" |
| 1585 | + "code": "client.cluster().state(s -> s);\n" |
1578 | 1586 | } |
1579 | 1587 | ], |
1580 | 1588 | "specification/cluster/info/examples/request/ClusterInfoExample1.yaml": [ |
|
1652 | 1660 | }, |
1653 | 1661 | { |
1654 | 1662 | "language": "Java", |
1655 | | - "code": "\n" |
| 1663 | + "code": "client.cluster().stats(s -> s);\n" |
1656 | 1664 | } |
1657 | 1665 | ], |
1658 | 1666 | "specification/cluster/get_component_template/examples/request/ClusterGetComponentTemplateExample1.yaml": [ |
|
1753 | 1761 | { |
1754 | 1762 | "language": "curl", |
1755 | 1763 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?detailed=true&actions=*/delete/byquery\"" |
| 1764 | + }, |
| 1765 | + { |
| 1766 | + "language": "Java", |
| 1767 | + "code": "client.tasks().list(l -> l\n .actions(\"*/delete/byquery\")\n .detailed(true)\n);\n" |
1756 | 1768 | } |
1757 | 1769 | ], |
1758 | 1770 | "specification/tasks/list/examples/request/ListTasksRequestExample1.yaml": [ |
|
1775 | 1787 | { |
1776 | 1788 | "language": "curl", |
1777 | 1789 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_tasks?actions=*search&detailed\"" |
| 1790 | + }, |
| 1791 | + { |
| 1792 | + "language": "Java", |
| 1793 | + "code": "client.tasks().list(l -> l\n .actions(\"*search\")\n .detailed(true)\n);\n" |
1778 | 1794 | } |
1779 | 1795 | ], |
1780 | 1796 | "specification/indices/simulate_template/examples/request/indicesSimulateTemplateRequestExample1.yaml": [ |
|
2213 | 2229 | { |
2214 | 2230 | "language": "curl", |
2215 | 2231 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_all/_settings?expand_wildcards=all&filter_path=*.settings.index.*.slowlog\"" |
| 2232 | + }, |
| 2233 | + { |
| 2234 | + "language": "Java", |
| 2235 | + "code": "client.indices().getSettings(g -> g\n .expandWildcards(\"all\")\n .index(\"_all\")\n);\n" |
2216 | 2236 | } |
2217 | 2237 | ], |
2218 | 2238 | "specification/indices/promote_data_stream/examples/request/IndicesPromoteDataStreamExample1.yaml": [ |
|
2339 | 2359 | { |
2340 | 2360 | "language": "curl", |
2341 | 2361 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all\"" |
| 2362 | + }, |
| 2363 | + { |
| 2364 | + "language": "Java", |
| 2365 | + "code": "client.indices().resolveIndex(r -> r\n .expandWildcards(\"all\")\n .name(List.of(\"f*\",\"remoteCluster1:bar*\"))\n);\n" |
2342 | 2366 | } |
2343 | 2367 | ], |
2344 | 2368 | "specification/indices/exists/examples/request/IndicesExistsExample1.yaml": [ |
|
2390 | 2414 | }, |
2391 | 2415 | { |
2392 | 2416 | "language": "Java", |
2393 | | - "code": "\n" |
| 2417 | + "code": "client.indices().recovery(r -> r);\n" |
2394 | 2418 | } |
2395 | 2419 | ], |
2396 | 2420 | "specification/indices/put_settings/examples/request/indicesPutSettingsRequestExample3.yaml": [ |
|
3110 | 3134 | }, |
3111 | 3135 | { |
3112 | 3136 | "language": "Java", |
3113 | | - "code": "\n" |
| 3137 | + "code": "client.indices().getIndexTemplate(g -> g\n .name(\"*\")\n);\n" |
3114 | 3138 | } |
3115 | 3139 | ], |
3116 | 3140 | "specification/indices/get_data_lifecycle/examples/request/IndicesGetDataLifecycleRequestExample1.yaml": [ |
|
3136 | 3160 | }, |
3137 | 3161 | { |
3138 | 3162 | "language": "Java", |
3139 | | - "code": "\n" |
| 3163 | + "code": "client.indices().getDataLifecycle(g -> g\n .name(\"{name}\")\n);\n" |
3140 | 3164 | } |
3141 | 3165 | ], |
3142 | 3166 | "specification/indices/get_data_stream/examples/request/IndicesGetDataStreamExample1.yaml": [ |
|
3393 | 3417 | { |
3394 | 3418 | "language": "curl", |
3395 | 3419 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_shard_stores?status=green\"" |
| 3420 | + }, |
| 3421 | + { |
| 3422 | + "language": "Java", |
| 3423 | + "code": "client.indices().shardStores(s -> s\n .status(\"green\")\n);\n" |
3396 | 3424 | } |
3397 | 3425 | ], |
3398 | 3426 | "specification/indices/get_data_stream_settings/examples/request/IndicesGetDataStreamSettingsRequestExample1.yaml": [ |
|
3756 | 3784 | }, |
3757 | 3785 | { |
3758 | 3786 | "language": "Java", |
3759 | | - "code": "\n" |
| 3787 | + "code": "client.indices().stats(s -> s\n .fields(\"my_join_field\")\n .metric(\"fielddata\")\n);\n" |
3760 | 3788 | } |
3761 | 3789 | ], |
3762 | 3790 | "specification/indices/segments/examples/request/IndicesSegmentsExample1.yaml": [ |
|
4951 | 4979 | { |
4952 | 4980 | "language": "curl", |
4953 | 4981 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"grid_agg\":\"geotile\",\"grid_precision\":2,\"fields\":[\"name\",\"price\"],\"query\":{\"term\":{\"included\":true}},\"aggs\":{\"min_price\":{\"min\":{\"field\":\"price\"}},\"max_price\":{\"max\":{\"field\":\"price\"}},\"avg_price\":{\"avg\":{\"field\":\"price\"}}}}' \"$ELASTICSEARCH_URL/museums/_mvt/location/13/4207/2692\"" |
| 4982 | + }, |
| 4983 | + { |
| 4984 | + "language": "Java", |
| 4985 | + "code": "client.searchMvt(s -> s\n .aggs(Map.of(\"max_price\", Aggregation.of(a -> a\n .max(m -> m\n .field(\"price\")\n )\n ),\"min_price\", Aggregation.of(ag -> ag\n .min(m -> m\n .field(\"price\")\n )\n ),\"avg_price\", Aggregation.of(agg -> agg\n .avg(av -> av\n .field(\"price\")\n )\n )))\n .field(\"location\")\n .fields(List.of(\"name\",\"price\"))\n .gridAgg(GridAggregationType.Geotile)\n .gridPrecision(2)\n .index(\"museums\")\n .query(q -> q\n .term(t -> t\n .field(\"included\")\n .value(FieldValue.of(true))\n )\n )\n .x(4207)\n .y(2692)\n .zoom(13)\n);\n" |
4954 | 4986 | } |
4955 | 4987 | ], |
4956 | 4988 | "specification/_global/delete_by_query_rethrottle/examples/request/DeleteByQueryRethrottleRequestExample1.yaml": [ |
|
4999 | 5031 | { |
5000 | 5032 | "language": "curl", |
5001 | 5033 | "code": "curl -X GET -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/my-index-000001/_doc/1?stored_fields=tags,counter\"" |
| 5034 | + }, |
| 5035 | + { |
| 5036 | + "language": "Java", |
| 5037 | + "code": "client.get(g -> g\n .id(\"1\")\n .index(\"my-index-000001\")\n .storedFields(List.of(\"tags\",\"counter\"))\n);\n" |
5002 | 5038 | } |
5003 | 5039 | ], |
5004 | 5040 | "specification/_global/render_search_template/examples/request/RenderSearchTemplateRequestExample1.yaml": [ |
|
5229 | 5265 | { |
5230 | 5266 | "language": "curl", |
5231 | 5267 | "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"index_filter\":{\"range\":{\"@timestamp\":{\"gte\":\"2018\"}}}}' \"$ELASTICSEARCH_URL/my-index-*/_field_caps?fields=rating\"" |
| 5268 | + }, |
| 5269 | + { |
| 5270 | + "language": "Java", |
| 5271 | + "code": "client.fieldCaps(f -> f\n .fields(\"rating\")\n .index(\"my-index-*\")\n .indexFilter(i -> i\n .range(r -> r\n .untyped(u -> u\n .field(\"@timestamp\")\n .gte(JsonData.fromJson(\"\\\"2018\\\"\"))\n )\n )\n )\n);\n" |
5232 | 5272 | } |
5233 | 5273 | ], |
5234 | 5274 | "specification/_global/search/examples/request/SearchRequestExample1.yaml": [ |
|
9458 | 9498 | }, |
9459 | 9499 | { |
9460 | 9500 | "language": "Java", |
9461 | | - "code": "\n" |
| 9501 | + "code": "client.nodes().stats(s -> s\n .metric(\"process\")\n);\n" |
9462 | 9502 | } |
9463 | 9503 | ], |
9464 | 9504 | "specification/ingest/get_pipeline/examples/request/IngestGetPipelineExample1.yaml": [ |
|
9952 | 9992 | }, |
9953 | 9993 | { |
9954 | 9994 | "language": "Java", |
9955 | | - "code": "\n" |
| 9995 | + "code": "client.slm().getLifecycle(g -> g\n .policyId(\"daily-snapshots\")\n);\n" |
9956 | 9996 | } |
9957 | 9997 | ], |
9958 | 9998 | "specification/slm/put_lifecycle/examples/request/PutSnapshotLifecycleRequestExample1 copy.yaml": [ |
@@ -10296,23 +10336,23 @@ |
10296 | 10336 | "specification/synonyms/put_synonym/examples/request/SynonymsPutRequestExample1.yaml": [ |
10297 | 10337 | { |
10298 | 10338 | "language": "Python", |
10299 | | - "code": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n)" |
| 10339 | + "code": "resp = client.synonyms.put_synonym(\n id=\"my-synonyms-set\",\n synonyms_set=\"hello, hi, howdy\",\n)" |
10300 | 10340 | }, |
10301 | 10341 | { |
10302 | 10342 | "language": "JavaScript", |
10303 | | - "code": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n});" |
| 10343 | + "code": "const response = await client.synonyms.putSynonym({\n id: \"my-synonyms-set\",\n synonyms_set: \"hello, hi, howdy\",\n});" |
10304 | 10344 | }, |
10305 | 10345 | { |
10306 | 10346 | "language": "Ruby", |
10307 | | - "code": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\"\n)" |
| 10347 | + "code": "response = client.synonyms.put_synonym(\n id: \"my-synonyms-set\",\n body: {\n \"synonyms_set\": \"hello, hi, howdy\"\n }\n)" |
10308 | 10348 | }, |
10309 | 10349 | { |
10310 | 10350 | "language": "PHP", |
10311 | | - "code": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n]);" |
| 10351 | + "code": "$resp = $client->synonyms()->putSynonym([\n \"id\" => \"my-synonyms-set\",\n \"body\" => [\n \"synonyms_set\" => \"hello, hi, howdy\",\n ],\n]);" |
10312 | 10352 | }, |
10313 | 10353 | { |
10314 | 10354 | "language": "curl", |
10315 | | - "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" |
| 10355 | + "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"synonyms_set\":\"hello, hi, howdy\"}' \"$ELASTICSEARCH_URL/_synonyms/my-synonyms-set\"" |
10316 | 10356 | } |
10317 | 10357 | ], |
10318 | 10358 | "specification/dangling_indices/list_dangling_indices/examples/request/DanglingIndicesListDanglingIndicesExample1.yaml": [ |
|
10702 | 10742 | }, |
10703 | 10743 | { |
10704 | 10744 | "language": "Java", |
10705 | | - "code": "\n" |
| 10745 | + "code": "client.ml().putDatafeed(p -> p\n .datafeedId(\"datafeed-test-job\")\n .indices(\"kibana_sample_data_logs\")\n .jobId(\"test-job\")\n .query(q -> q\n .bool(b -> b\n .must(m -> m\n .matchAll(ma -> ma)\n )\n )\n )\n);\n" |
10706 | 10746 | } |
10707 | 10747 | ], |
10708 | 10748 | "specification/ml/update_job/examples/request/MlUpdateJobExample1.yaml": [ |
|
11690 | 11730 | }, |
11691 | 11731 | { |
11692 | 11732 | "language": "Java", |
11693 | | - "code": "\n" |
| 11733 | + "code": "client.ml().getMemoryStats(g -> g);\n" |
11694 | 11734 | } |
11695 | 11735 | ], |
11696 | 11736 | "specification/ml/start_datafeed/examples/request/MlStartDatafeedExample1.yaml": [ |
|
12077 | 12117 | { |
12078 | 12118 | "language": "curl", |
12079 | 12119 | "code": "curl -X PUT -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"definition\":\"...\",\"total_definition_length\":265632637,\"total_parts\":64}' \"$ELASTICSEARCH_URL/_ml/trained_models/elastic__distilbert-base-uncased-finetuned-conll03-english/definition/0\"" |
| 12120 | + }, |
| 12121 | + { |
| 12122 | + "language": "Java", |
| 12123 | + "code": "client.ml().putTrainedModelDefinitionPart(p -> p\n .definition(\"...\")\n .modelId(\"elastic__distilbert-base-uncased-finetuned-conll03-english\")\n .part(0)\n .totalDefinitionLength(265632637L)\n .totalParts(64)\n);\n" |
12080 | 12124 | } |
12081 | 12125 | ], |
12082 | 12126 | "specification/ml/put_data_frame_analytics/examples/request/MlPutDataFrameAnalyticsExample1.yaml": [ |
|
0 commit comments