From 75486f8ee851662f002938e484677b621a0773af Mon Sep 17 00:00:00 2001 From: Niyazbek Torekeldi <78027392+Tokesh@users.noreply.github.com> Date: Mon, 4 Sep 2023 21:23:01 +0600 Subject: [PATCH 01/30] adding required parameter to few security api (#149) Signed-off-by: Niyazbek Torekeldi <78027392+Tokesh@users.noreply.github.com> --- model/security/create_action_group/structures.smithy | 1 + model/security/create_tenant/structures.smithy | 1 + model/security/patch_action_group/structures.smithy | 1 + model/security/patch_action_groups/structures.smithy | 1 + 4 files changed, 4 insertions(+) diff --git a/model/security/create_action_group/structures.smithy b/model/security/create_action_group/structures.smithy index 309c2c5ba..39f8092dd 100644 --- a/model/security/create_action_group/structures.smithy +++ b/model/security/create_action_group/structures.smithy @@ -13,6 +13,7 @@ structure CreateActionGroup_Input { @httpLabel @documentation("The name of the action group to create or replace") action_group: String + @required @httpPayload content: Action_Group } diff --git a/model/security/create_tenant/structures.smithy b/model/security/create_tenant/structures.smithy index 03562f127..727705c63 100644 --- a/model/security/create_tenant/structures.smithy +++ b/model/security/create_tenant/structures.smithy @@ -12,6 +12,7 @@ structure CreateTenant_Input { @required @httpLabel tenant: String + @required @httpPayload content: CreateTenantParams } diff --git a/model/security/patch_action_group/structures.smithy b/model/security/patch_action_group/structures.smithy index 827ed54d8..42a3b0e2f 100644 --- a/model/security/patch_action_group/structures.smithy +++ b/model/security/patch_action_group/structures.smithy @@ -12,6 +12,7 @@ structure PatchActionGroup_Input { @required @httpLabel action_group: String + @required @httpPayload content: PatchOperationList } diff --git a/model/security/patch_action_groups/structures.smithy b/model/security/patch_action_groups/structures.smithy index 023de5ee2..3414feb59 100644 --- a/model/security/patch_action_groups/structures.smithy +++ b/model/security/patch_action_groups/structures.smithy @@ -9,6 +9,7 @@ namespace OpenSearch @input structure PatchActionGroups_Input { + @required @httpPayload content: PatchOperationList } From 10e9c29808de78063b7282bbf66c4521d4acde42 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 6 Sep 2023 03:29:17 +1200 Subject: [PATCH 02/30] Correct index metric enum options (#150) Signed-off-by: Thomas Farr --- model/common_strings.smithy | 42 +++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/model/common_strings.smithy b/model/common_strings.smithy index d793be543..7c0d79cbe 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -28,7 +28,26 @@ string PathComponentTemplateNames string PathFields @xDataType("array") -@xEnumOptions(["_all", "completion", "docs", "fielddata", "query_cache", "flush", "get", "indexing", "merge", "request_cache", "refresh", "search", "segments", "store", "warmer", "suggest"]) +@xEnumOptions([ + "_all", + "store", + "indexing", + "get", + "search", + "merge", + "flush", + "refresh", + "query_cache", + "fielddata", + "docs", + "warmer", + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" +]) @pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") @documentation("Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.") string PathIndexMetric @@ -44,7 +63,26 @@ string PathIndexNames string PathIndices @xDataType("array") -@xEnumOptions(["_all", "completion", "docs", "fielddata", "query_cache", "flush", "get", "indexing", "merge", "request_cache", "refresh", "search", "segments", "store", "warmer", "suggest"]) +@xEnumOptions([ + "_all", + "store", + "indexing", + "get", + "search", + "merge", + "flush", + "refresh", + "query_cache", + "fielddata", + "docs", + "warmer", + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" +]) @pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") @documentation("Limit the information returned the specific metrics.") string PathIndicesStatsMetric From 6709df449eb81b3a907f169a20e301a27b90d06e Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 08:47:57 +1200 Subject: [PATCH 03/30] Update OpenAPI specs (#151) Signed-off-by: GitHub Co-authored-by: nhtruong --- OpenSearch.openapi.json | 108 ++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 48 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index fb73202fd..a34c78380 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -10646,21 +10646,23 @@ "description": "Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, @@ -11444,21 +11446,23 @@ "description": "Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, @@ -11819,7 +11823,8 @@ "$ref": "#/components/schemas/PatchActionGroupsInputPayload" } } - } + }, + "required": true }, "responses": { "200": { @@ -11944,7 +11949,8 @@ "$ref": "#/components/schemas/PatchActionGroupInputPayload" } } - } + }, + "required": true }, "parameters": [ { @@ -11985,7 +11991,8 @@ "$ref": "#/components/schemas/Action_Group" } } - } + }, + "required": true }, "parameters": [ { @@ -13240,7 +13247,8 @@ "$ref": "#/components/schemas/CreateTenantParams" } } - } + }, + "required": true }, "parameters": [ { @@ -17921,21 +17929,23 @@ "description": "Limit the information returned the specific metrics.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, @@ -28502,21 +28512,23 @@ "description": "Limit the information returned the specific metrics.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, From 7cded7c8f275c61ee3513a28ea4ec5eba927176b Mon Sep 17 00:00:00 2001 From: Jakob Gillich Date: Mon, 2 Oct 2023 02:17:00 +0200 Subject: [PATCH 04/30] Fix missing pluralization on Role (#153) * Fix missing pluralization on Role Signed-off-by: Jakob Gillich * Fix index_permissions not being a list Signed-off-by: Jakob Gillich * Add missing dls field on IndexPermission Signed-off-by: Jakob Gillich * Add TenantPermission struct Signed-off-by: Jakob Gillich --------- Signed-off-by: Jakob Gillich --- model/security/role.smithy | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/model/security/role.smithy b/model/security/role.smithy index 32c9f96f7..951a0da4b 100644 --- a/model/security/role.smithy +++ b/model/security/role.smithy @@ -16,9 +16,9 @@ structure Role { reserved: Boolean hidden: Boolean description: String - cluster_permission: ClusterPermission - index_permission: IndexPermission - tenant_permissions: TenantPermission + cluster_permissions: ClusterPermission + index_permissions: IndexPermissionList + tenant_permissions: TenantPermissionList static: Boolean } @@ -28,12 +28,26 @@ list ClusterPermission { structure IndexPermission { index_patterns: IndexPatterns + dls: String fls: Fls masked_fields: MaskedFields allowed_actions: AllowedActions } -list TenantPermission { +list IndexPermissionList { + member: IndexPermission +} + +structure TenantPermission { + tenant_patterns: TenantPatterns + allowed_actions: AllowedActions +} + +list TenantPermissionList { + member: TenantPermission +} + +list TenantPatterns { member: String } From 037843f96c36349b943514ffb59198d9c0855296 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 08:45:53 -0600 Subject: [PATCH 05/30] Update OpenAPI specs (#154) Signed-off-by: GitHub Co-authored-by: VachaShah --- OpenSearch.openapi.json | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index a34c78380..896dfa459 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -31170,6 +31170,9 @@ "type": "string" } }, + "dls": { + "type": "string" + }, "fls": { "type": "array", "items": { @@ -31885,19 +31888,22 @@ "description": { "type": "string" }, - "cluster_permission": { + "cluster_permissions": { "type": "array", "items": { "type": "string" } }, - "index_permission": { - "$ref": "#/components/schemas/IndexPermission" + "index_permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IndexPermission" + } }, "tenant_permissions": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/TenantPermission" } }, "static": { @@ -32220,6 +32226,23 @@ } } }, + "TenantPermission": { + "type": "object", + "properties": { + "tenant_patterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "allowed_actions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "TenantsMap": { "type": "object", "additionalProperties": { From 1fbcc5ab5967c8c982f0fef2b75fc3fbef22482f Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Sun, 15 Oct 2023 15:28:21 -0700 Subject: [PATCH 06/30] Fixed spec to make it inline with server (#161) Signed-off-by: saimedhi --- model/_global/delete_pit/structures.smithy | 1 + model/cluster/exists_component_template/structures.smithy | 3 +++ model/cluster/health/structures.smithy | 4 ---- model/indices/delete/structures.smithy | 3 +++ model/indices/exists_index_template/structures.smithy | 3 +++ model/indices/exists_template/structures.smithy | 3 +++ model/indices/open/structures.smithy | 3 +++ 7 files changed, 16 insertions(+), 4 deletions(-) diff --git a/model/_global/delete_pit/structures.smithy b/model/_global/delete_pit/structures.smithy index 5a39dff36..c25b2cfa2 100644 --- a/model/_global/delete_pit/structures.smithy +++ b/model/_global/delete_pit/structures.smithy @@ -21,6 +21,7 @@ list PitIds{ } +@documentation("The point-in-time ids to be deleted") structure DeletePit_BodyParams { @required pit_id: PitIds diff --git a/model/cluster/exists_component_template/structures.smithy b/model/cluster/exists_component_template/structures.smithy index 1c37806d3..d41e9bccf 100644 --- a/model/cluster/exists_component_template/structures.smithy +++ b/model/cluster/exists_component_template/structures.smithy @@ -12,6 +12,9 @@ structure ClusterExistsComponentTemplate_QueryParams { @httpQuery("master_timeout") master_timeout: MasterTimeout, + @httpQuery("cluster_manager_timeout") + cluster_manager_timeout: ClusterManagerTimeout, + @httpQuery("local") @default(false) local: Local, diff --git a/model/cluster/health/structures.smithy b/model/cluster/health/structures.smithy index 7daeb9c4b..577806a32 100644 --- a/model/cluster/health/structures.smithy +++ b/model/cluster/health/structures.smithy @@ -51,10 +51,6 @@ structure ClusterHealth_QueryParams { @httpQuery("awareness_attribute") awareness_attribute: AwarenessAttribute, - - @httpQuery("ensure_node_commissioned") - @default(false) - ensure_node_commissioned: EnsureNodeCommissioned, } diff --git a/model/indices/delete/structures.smithy b/model/indices/delete/structures.smithy index aef5862b4..d5f1ced49 100644 --- a/model/indices/delete/structures.smithy +++ b/model/indices/delete/structures.smithy @@ -23,6 +23,9 @@ structure IndicesDelete_QueryParams { @default(false) allow_no_indices: AllowNoIndices, + @httpQuery("cluster_manager_timeout") + cluster_manager_timeout: ClusterManagerTimeout, + @httpQuery("expand_wildcards") @default("open") expand_wildcards: ExpandWildcards, diff --git a/model/indices/exists_index_template/structures.smithy b/model/indices/exists_index_template/structures.smithy index ae9de4233..c6b0b0adf 100644 --- a/model/indices/exists_index_template/structures.smithy +++ b/model/indices/exists_index_template/structures.smithy @@ -16,6 +16,9 @@ structure IndicesExistsIndexTemplate_QueryParams { @httpQuery("master_timeout") master_timeout: MasterTimeout, + @httpQuery("cluster_manager_timeout") + cluster_manager_timeout: ClusterManagerTimeout, + @httpQuery("local") @default(false) local: Local, diff --git a/model/indices/exists_template/structures.smithy b/model/indices/exists_template/structures.smithy index 5d3785bfc..ef7473968 100644 --- a/model/indices/exists_template/structures.smithy +++ b/model/indices/exists_template/structures.smithy @@ -16,6 +16,9 @@ structure IndicesExistsTemplate_QueryParams { @httpQuery("master_timeout") master_timeout: MasterTimeout, + @httpQuery("cluster_manager_timeout") + cluster_manager_timeout: ClusterManagerTimeout, + @httpQuery("local") @default(false) local: Local, diff --git a/model/indices/open/structures.smithy b/model/indices/open/structures.smithy index 8743df8ad..5719ca606 100644 --- a/model/indices/open/structures.smithy +++ b/model/indices/open/structures.smithy @@ -25,6 +25,9 @@ structure IndicesOpen_QueryParams { @default("closed") expand_wildcards: ExpandWildcards, + @httpQuery("cluster_manager_timeout") + cluster_manager_timeout: ClusterManagerTimeout, + @httpQuery("wait_for_active_shards") @documentation("Sets the number of active shards to wait for before the operation returns.") wait_for_active_shards: WaitForActiveShards, From 521f4a23f0389af7dd99b497c94f8c2511e752e2 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:02:54 -0700 Subject: [PATCH 07/30] Update OpenAPI specs (#162) Signed-off-by: GitHub Co-authored-by: Xtansia --- OpenSearch.openapi.json | 81 +++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index 896dfa459..f5d1761bb 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -5119,16 +5119,6 @@ "type": "string", "description": "The awareness attribute for which the health is required." } - }, - { - "name": "ensure_node_commissioned", - "in": "query", - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned.", - "schema": { - "type": "boolean", - "default": false, - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned." - } } ], "responses": { @@ -5280,16 +5270,6 @@ "type": "string", "description": "The awareness attribute for which the health is required." } - }, - { - "name": "ensure_node_commissioned", - "in": "query", - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned.", - "schema": { - "type": "boolean", - "default": false, - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned." - } } ], "responses": { @@ -6831,6 +6811,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -8536,6 +8528,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -18594,6 +18598,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -19451,6 +19467,18 @@ "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "expand_wildcards", "in": "query", @@ -25302,6 +25330,18 @@ "$ref": "#/components/schemas/ExpandWildcards" } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "wait_for_active_shards", "in": "query", @@ -30868,6 +30908,7 @@ }, "DeletePit_BodyParams": { "type": "object", + "description": "The point-in-time ids to be deleted", "properties": { "pit_id": { "type": "array", From 3775ec6eb318a3640199db097e1d99e782ee5c9e Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Fri, 10 Nov 2023 17:38:37 -0500 Subject: [PATCH 08/30] Fix: typo, missing space. (#165) Signed-off-by: dblock --- OpenSearch.openapi.json | 8 ++++---- model/common_enums.smithy | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index f5d1761bb..378f6b0db 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -22364,7 +22364,7 @@ { "name": "op_type", "in": "query", - "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID.", + "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create` for requests without an explicit document ID.", "schema": { "$ref": "#/components/schemas/OpType" } @@ -22961,7 +22961,7 @@ { "name": "op_type", "in": "query", - "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID.", + "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create` for requests without an explicit document ID.", "schema": { "$ref": "#/components/schemas/OpType" } @@ -23109,7 +23109,7 @@ { "name": "op_type", "in": "query", - "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID.", + "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create` for requests without an explicit document ID.", "schema": { "$ref": "#/components/schemas/OpType" } @@ -31512,7 +31512,7 @@ }, "OpType": { "type": "string", - "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID.", + "description": "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create` for requests without an explicit document ID.", "enum": [ "index", "create" diff --git a/model/common_enums.smithy b/model/common_enums.smithy index 76123ee6b..3286ad534 100644 --- a/model/common_enums.smithy +++ b/model/common_enums.smithy @@ -84,7 +84,7 @@ enum NodesStatLevel { SHARDS = "shards" } -@documentation("Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID.") +@documentation("Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create` for requests without an explicit document ID.") enum OpType { INDEX = "index" CREATE = "create" From 141938072013af422f48f67eaf847ce1398f13e9 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 28 Nov 2023 10:04:17 +1300 Subject: [PATCH 09/30] Mark `keep_alive` as `time` type and correct `_shards` field name (#163) Signed-off-by: Thomas Farr --- model/_global/create_pit/structures.smithy | 2 +- model/common_strings.smithy | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/model/_global/create_pit/structures.smithy b/model/_global/create_pit/structures.smithy index a7382409e..5516a6fd3 100644 --- a/model/_global/create_pit/structures.smithy +++ b/model/_global/create_pit/structures.smithy @@ -37,6 +37,6 @@ structure CreatePit_Input with [CreatePit_QueryParams] { @output structure CreatePit_Output { pit_id: String, - _shard: ShardStatistics, + _shards: ShardStatistics, creation_time: Long } diff --git a/model/common_strings.smithy b/model/common_strings.smithy index 7c0d79cbe..361f29b59 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -270,6 +270,8 @@ string Format string Index +@xDataType("time") +@pattern("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$") @documentation("Specify the keep alive for point in time.") string KeepAlive From b42000c7a409560b2120f8c8f71ff238c33d5f0b Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:11:11 -0700 Subject: [PATCH 10/30] Update OpenAPI specs (#166) Signed-off-by: GitHub Co-authored-by: nhtruong --- OpenSearch.openapi.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index 378f6b0db..a4ba7bf8d 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -26671,7 +26671,9 @@ "description": "Specify the keep alive for point in time.", "schema": { "type": "string", - "description": "Specify the keep alive for point in time." + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Specify the keep alive for point in time.", + "x-data-type": "time" } }, { @@ -30719,7 +30721,7 @@ "pit_id": { "type": "string" }, - "_shard": { + "_shards": { "$ref": "#/components/schemas/ShardStatistics" }, "creation_time": { From b6bf3fbdad05d9c4077d57b2e2478880b17e27fb Mon Sep 17 00:00:00 2001 From: Niyazbek Torekeldi <78027392+Tokesh@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:17:32 +0600 Subject: [PATCH 11/30] adding query params to node metrics and index api specs (#174) Signed-off-by: Tokesh --- model/_global/search/structures.smithy | 3 +++ model/common_strings.smithy | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/model/_global/search/structures.smithy b/model/_global/search/structures.smithy index 4954a3e54..97a47e82a 100644 --- a/model/_global/search/structures.smithy +++ b/model/_global/search/structures.smithy @@ -149,6 +149,9 @@ structure Search_QueryParams { @httpQuery("rest_total_hits_as_int") @default(false) rest_total_hits_as_int: RestTotalHitsAsInt, + + @httpQuery("search_pipeline") + search_pipeline: SearchPipeline } @documentation("The search definition using the Query DSL") diff --git a/model/common_strings.smithy b/model/common_strings.smithy index 361f29b59..1be06b58c 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -104,7 +104,7 @@ string PathNodeId string PathNodesInfoMetric @xDataType("array") -@xEnumOptions(["_all", "breaker", "fs", "http", "indices", "jvm", "os", "process", "thread_pool", "transport", "discovery", "indexing_pressure"]) +@xEnumOptions(["_all", "breaker", "fs", "http", "indices", "jvm", "os", "process", "thread_pool", "transport", "discovery", "indexing_pressure", "search_pipeline"]) @pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") @documentation("Limit the information returned to the specified metrics.") string PathNodesStatsMetric @@ -289,6 +289,9 @@ string ParentTaskId @documentation("The pipeline id to preprocess incoming documents with.") string Pipeline +@documentation("Customizable sequence of processing stages applied to search queries.") +string SearchPipeline + @documentation("Specify the node or shard the operation should be performed on.") string Preference From de6711eeaa6a801e922b7bc7fae355adb94151f9 Mon Sep 17 00:00:00 2001 From: Theo Nam Truong Date: Mon, 8 Jan 2024 12:18:28 -0700 Subject: [PATCH 12/30] Updated Guides to clarify Operation Group. (#170) * Updated Guides to clarify Operation Group. Signed-off-by: Theo Truong * # Signed-off-by: Theo Truong --------- Signed-off-by: Theo Truong --- CLIENT_GENERATOR_GUIDE.md | 19 ++++++++++--------- DEVELOPER_GUIDE.md | 10 +++++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CLIENT_GENERATOR_GUIDE.md b/CLIENT_GENERATOR_GUIDE.md index 4ab492d97..d97b10fa0 100644 --- a/CLIENT_GENERATOR_GUIDE.md +++ b/CLIENT_GENERATOR_GUIDE.md @@ -23,21 +23,22 @@ In the [OpenAPI spec](./OpenSearch.openapi.json), this grouping is denoted by `x - If two operations have identical HTTP methods, but different paths: use the path that best matches the path parameters provided. - If two operations have identical path, but different HTTP methods: - GET/POST: if the request body is provided then use POST, otherwise use GET - - PUT/POST: Either works, but PUT is preferred. + - PUT/POST: Either works, but PUT is preferred when an optional path parameter is provided. The psuedo-code that combines the `search` operations into a single API method is as follows: ```python def search(self, index=None, body=None): if index is None: - if body is None: - return self.perform_request("GET", "/_search") - else: - return self.perform_request("POST", "/_search", body=body) + path = "/_search" else: - if body is None: - return self.perform_request("GET", f"/{index}/_search") - else: - return self.perform_request("POST", f"/{index}/_search", body=body) + path = f"/{index}/_search" + + if body is None: + method = "GET" + else: + method = "POST" + + return self.perform_request(method, path, body=body) ``` ## Handling Path Parameters diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 15cc5639a..572e3af04 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -54,7 +54,7 @@ Popular IDEs for Smithy models include Visual Studio Code and IntelliJ, and they - [OpenAPI Specifications](https://plugins.jetbrains.com/plugin/14394-openapi-specifications) ## File Structure -The OpenSearch API is composed of over 300 operations. These operations are grouped into API actions based on the functionality they provide. Each API action is later translated to an API method in each OpenSearch client. For example: +The OpenSearch API is composed of over 300 operations. These operations are grouped into API actions based on the functionality they provide (This grouping is done through the `@xOperationGroup` Smithy trait). Each API action is later translated to an API method in each OpenSearch client. For example: - The `cat.health` action will turn into `client.cat.health()` - While the `index` action will turn into `client.index()` @@ -95,6 +95,9 @@ As mentioned in the previous section, each API action is composed of multiple op - `GET /{index}/_search` - `POST /{index}/_search` +To group these operations together in the `search` action, we mark them with the `@xOperationGroup` trait with the same value of `search`. Note that this trait tells the client generators that these operations serve identical purpose and should be grouped together in the same API method. The `xOperationGroup` trait also tells the generators the namespace and the name of the API method. For example, operations with `xOperationGroup` trait value of `indicies.create` will result in `client.indices.create()` method to be generated. + + ### Defining operations We name each operation using the following format `[ActionName]_[HttpVerb]_[PathParameters]` @@ -194,16 +197,17 @@ structure Operation_Output { ## Defining Common Parameters -Common parameters are defined in the root folder, `model/`, and grouped by data-type in files of `common_.smithy` format. There are a few things to note when defining common parameters: +Common parameters that are used across OpenSearch namespaces are defined in the root folder, `model/`, and grouped by data-type in files of `common_.smithy` format. There are a few things to note when defining global common parameters: - All path parameters should be prefixed with `Path` like `PathIndex` and `PathDocumentID`. - Smithy doesn't support _enum_ or _list_ as path parameters. We, therefore, have to define such parameters as _string_ and use `x-data-type` vendor extension to denote their actual types (More on this in the traits section). - Parameters of type `time` are defined as `string` and has `@pattern("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")` trait to denote that they are in the format of ``. E.g. `1d`, `2h`, `3m`, `4s`, `5ms`, `6micros`, `7nanos`. We use `x-data-type: "time"` vendor extension for this type. - Path parameters that are defined as strings must be accompanied by a `@pattern` trait and should be default to `^[^_][\\d\\w-*]*$` to signify that they are not allowed to start with `_` to avoid URI Conflict errors. - The `@documentation`, `@default`, and `@deprecation` traits can later be overridden by the operations that use these parameters. +Common parameters that are used within a namespace, especially namespaces representing plugins like `security` are defined in the namespace folder (e.g. `model/security`) + ## Smithy Traits We use Smithy traits extensively in this project to work around some limitations of Smithy and to deal with some quirks of the OpenSearch API. Here are some of the traits that you should be aware of: -- `@vendorExtensions`: Used to add metadata that are not supported by Smithy. Check OpenAPI Vendor Extensions section for more details. - `@suppress(["HttpMethodSemantics.UnexpectedPayload"])`: Used in DELETE operations with request body to suppress the UnexpectedPayload error. - `@suppress(["HttpUriConflict"])`: Used to suppress the HttpUriConflict error that is thrown when two operations have conflicting URI. Unfortunately, this happens a lot in OpenSearch API. When in doubt, add this trait to the operation. - `@pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless)")`: Required for most Path parameters to avoid URI Conflict errors. This is often used in tandem with the @suppress trait above. To denote the actual pattern of the parameter, use `x-string-pattern` vendor extension. From 95c8369961c06c67aa1d9c767ea7d78a120dfcb5 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:27:35 -0700 Subject: [PATCH 13/30] Update OpenAPI specs (#175) Signed-off-by: GitHub Co-authored-by: VachaShah --- OpenSearch.openapi.json | 48 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index a4ba7bf8d..b9426565c 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -10494,7 +10494,8 @@ "thread_pool", "transport", "discovery", - "indexing_pressure" + "indexing_pressure", + "search_pipeline" ], "x-data-type": "array" }, @@ -10634,7 +10635,8 @@ "thread_pool", "transport", "discovery", - "indexing_pressure" + "indexing_pressure", + "search_pipeline" ], "x-data-type": "array" }, @@ -11282,7 +11284,8 @@ "thread_pool", "transport", "discovery", - "indexing_pressure" + "indexing_pressure", + "search_pipeline" ], "x-data-type": "array" }, @@ -11434,7 +11437,8 @@ "thread_pool", "transport", "discovery", - "indexing_pressure" + "indexing_pressure", + "search_pipeline" ], "x-data-type": "array" }, @@ -14875,6 +14879,15 @@ "default": false, "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." } + }, + { + "name": "search_pipeline", + "in": "query", + "description": "Customizable sequence of processing stages applied to search queries.", + "schema": { + "type": "string", + "description": "Customizable sequence of processing stages applied to search queries." + } } ], "responses": { @@ -15359,6 +15372,15 @@ "default": false, "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." } + }, + { + "name": "search_pipeline", + "in": "query", + "description": "Customizable sequence of processing stages applied to search queries.", + "schema": { + "type": "string", + "description": "Customizable sequence of processing stages applied to search queries." + } } ], "responses": { @@ -26092,6 +26114,15 @@ "default": false, "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." } + }, + { + "name": "search_pipeline", + "in": "query", + "description": "Customizable sequence of processing stages applied to search queries.", + "schema": { + "type": "string", + "description": "Customizable sequence of processing stages applied to search queries." + } } ], "responses": { @@ -26595,6 +26626,15 @@ "default": false, "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." } + }, + { + "name": "search_pipeline", + "in": "query", + "description": "Customizable sequence of processing stages applied to search queries.", + "schema": { + "type": "string", + "description": "Customizable sequence of processing stages applied to search queries." + } } ], "responses": { From 45e94a7001649e47fd5da1bccc9084bce8a6269c Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 10 Jan 2024 05:44:58 +1300 Subject: [PATCH 14/30] Correct cat.cluster_manager version added (#176) And conversely the cat.master version deprecated. Signed-off-by: Thomas Farr --- model/cat/cluster_manager/operations.smithy | 2 +- model/cat/master/operations.smithy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model/cat/cluster_manager/operations.smithy b/model/cat/cluster_manager/operations.smithy index 5bbf84f3c..c7fc80d83 100644 --- a/model/cat/cluster_manager/operations.smithy +++ b/model/cat/cluster_manager/operations.smithy @@ -12,7 +12,7 @@ namespace OpenSearch ) @xOperationGroup("cat.cluster_manager") -@xVersionAdded("1.0") +@xVersionAdded("2.0") @readonly @suppress(["HttpUriConflict"]) @http(method: "GET", uri: "/_cat/cluster_manager") diff --git a/model/cat/master/operations.smithy b/model/cat/master/operations.smithy index c1bca28bf..e2b61b1c2 100644 --- a/model/cat/master/operations.smithy +++ b/model/cat/master/operations.smithy @@ -15,7 +15,7 @@ namespace OpenSearch @xOperationGroup("cat.master") @xVersionAdded("1.0") @xDeprecationMessage("To promote inclusive language, please use '/_cat/cluster_manager' instead.") -@xVersionDeprecated("1.0") +@xVersionDeprecated("2.0") @readonly @suppress(["HttpUriConflict"]) @http(method: "GET", uri: "/_cat/master") From c190accba726c9c3ce2187f44c3ec6c57665c3e8 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 13:47:26 -0800 Subject: [PATCH 15/30] Update OpenAPI specs (#177) Signed-off-by: GitHub Co-authored-by: nhtruong --- OpenSearch.openapi.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index b9426565c..dfb7e3695 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -1323,7 +1323,7 @@ } }, "x-operation-group": "cat.cluster_manager", - "x-version-added": "1.0" + "x-version-added": "2.0" } }, "/_cat/count": { @@ -2239,7 +2239,7 @@ "x-deprecation-message": "To promote inclusive language, please use '/_cat/cluster_manager' instead.", "x-operation-group": "cat.master", "x-version-added": "1.0", - "x-version-deprecated": "1.0" + "x-version-deprecated": "2.0" } }, "/_cat/nodeattrs": { From 541f02236a14e7a3094fc654cf54cd5fad226f4e Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Wed, 17 Jan 2024 16:43:35 -0800 Subject: [PATCH 16/30] Adding wait_for_completion and task_execution_timeout params (#180) Signed-off-by: Vacha Shah --- model/common_strings.smithy | 5 +++++ model/indices/clone/structures.smithy | 7 +++++++ model/indices/forcemerge/structures.smithy | 4 ++++ model/indices/open/structures.smithy | 7 +++++++ model/indices/shrink/structures.smithy | 7 +++++++ model/indices/split/structures.smithy | 7 +++++++ 6 files changed, 37 insertions(+) diff --git a/model/common_strings.smithy b/model/common_strings.smithy index 1be06b58c..b6a2c928c 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -361,3 +361,8 @@ string Timeout @pattern("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$") @documentation("The maximum time to wait for wait_for_metadata_version before timing out.") string WaitForTimeout + +@xDataType("time") +@pattern("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$") +@documentation("Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.") +string TaskExecutionTimeout diff --git a/model/indices/clone/structures.smithy b/model/indices/clone/structures.smithy index b538f6fe8..b84cb4b0c 100644 --- a/model/indices/clone/structures.smithy +++ b/model/indices/clone/structures.smithy @@ -21,6 +21,13 @@ structure IndicesClone_QueryParams { @httpQuery("wait_for_active_shards") @documentation("Set the number of active shards to wait for on the cloned index before the operation returns.") wait_for_active_shards: WaitForActiveShards, + + @httpQuery("wait_for_completion") + @default(true) + wait_for_completion: WaitForCompletionTrue, + + @httpQuery("task_execution_timeout") + task_execution_timeout: TaskExecutionTimeout, } // TODO: Fill in Body Parameters diff --git a/model/indices/forcemerge/structures.smithy b/model/indices/forcemerge/structures.smithy index 8f291ef79..655da3d9e 100644 --- a/model/indices/forcemerge/structures.smithy +++ b/model/indices/forcemerge/structures.smithy @@ -28,6 +28,10 @@ structure IndicesForcemerge_QueryParams { @httpQuery("only_expunge_deletes") only_expunge_deletes: OnlyExpungeDeletes, + + @httpQuery("wait_for_completion") + @default(true) + wait_for_completion: WaitForCompletionTrue, } diff --git a/model/indices/open/structures.smithy b/model/indices/open/structures.smithy index 5719ca606..f99cdf1ab 100644 --- a/model/indices/open/structures.smithy +++ b/model/indices/open/structures.smithy @@ -31,6 +31,13 @@ structure IndicesOpen_QueryParams { @httpQuery("wait_for_active_shards") @documentation("Sets the number of active shards to wait for before the operation returns.") wait_for_active_shards: WaitForActiveShards, + + @httpQuery("wait_for_completion") + @default(true) + wait_for_completion: WaitForCompletionTrue, + + @httpQuery("task_execution_timeout") + task_execution_timeout: TaskExecutionTimeout, } diff --git a/model/indices/shrink/structures.smithy b/model/indices/shrink/structures.smithy index 15b0b9248..5fdb7d997 100644 --- a/model/indices/shrink/structures.smithy +++ b/model/indices/shrink/structures.smithy @@ -25,6 +25,13 @@ structure IndicesShrink_QueryParams { @httpQuery("wait_for_active_shards") @documentation("Set the number of active shards to wait for on the shrunken index before the operation returns.") wait_for_active_shards: WaitForActiveShards, + + @httpQuery("wait_for_completion") + @default(true) + wait_for_completion: WaitForCompletionTrue, + + @httpQuery("task_execution_timeout") + task_execution_timeout: TaskExecutionTimeout, } // TODO: Fill in Body Parameters diff --git a/model/indices/split/structures.smithy b/model/indices/split/structures.smithy index 72ef2086c..c21d1c74d 100644 --- a/model/indices/split/structures.smithy +++ b/model/indices/split/structures.smithy @@ -25,6 +25,13 @@ structure IndicesSplit_QueryParams { @httpQuery("wait_for_active_shards") @documentation("Set the number of active shards to wait for on the shrunken index before the operation returns.") wait_for_active_shards: WaitForActiveShards, + + @httpQuery("wait_for_completion") + @default(true) + wait_for_completion: WaitForCompletionTrue, + + @httpQuery("task_execution_timeout") + task_execution_timeout: TaskExecutionTimeout, } // TODO: Fill in Body Parameters From 6a8d99c30d4e192b67716c398001e73c0e056b1d Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 08:42:21 -0700 Subject: [PATCH 17/30] Update OpenAPI specs (#181) Signed-off-by: GitHub Co-authored-by: VachaShah --- OpenSearch.openapi.json | 167 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index dfb7e3695..982adfd49 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -8032,6 +8032,16 @@ "type": "boolean", "description": "Specify whether the operation should only expunge deleted documents." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } } ], "responses": { @@ -21197,6 +21207,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the cloned index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -21291,6 +21322,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the cloned index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -23950,6 +24002,16 @@ "type": "boolean", "description": "Specify whether the operation should only expunge deleted documents." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } } ], "responses": { @@ -25372,6 +25434,27 @@ "type": "string", "description": "Sets the number of active shards to wait for before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -27829,6 +27912,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -27933,6 +28037,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -28323,6 +28448,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { @@ -28427,6 +28573,27 @@ "type": "string", "description": "Set the number of active shards to wait for on the shrunken index before the operation returns." } + }, + { + "name": "wait_for_completion", + "in": "query", + "description": "Should this request wait until the operation has completed before returning.", + "schema": { + "type": "boolean", + "default": true, + "description": "Should this request wait until the operation has completed before returning." + } + }, + { + "name": "task_execution_timeout", + "in": "query", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.", + "x-data-type": "time" + } } ], "responses": { From 569abf58263ebc46664e9cefe576b45254862de3 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 24 Jan 2024 08:29:15 +1300 Subject: [PATCH 18/30] Improve the cat.pit_segments and cat.segment_replication specifications (#182) * Improve the cat.pit_segments and cat.segment_replication specifications Signed-off-by: Thomas Farr * Correct version added for cat.segment_replication Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- model/cat/all_pit_segments/operations.smithy | 23 ------- model/cat/all_pit_segments/structures.smithy | 17 ----- model/cat/common_params.smithy | 28 +++++++++ model/cat/pit_segment.smithy | 25 -------- model/cat/pit_segments/operations.smithy | 15 ++++- model/cat/pit_segments/structures.smithy | 47 +++++++++++++- .../cat/segment_replication/operations.smithy | 4 +- .../cat/segment_replication/structures.smithy | 62 +++++++++++++------ model/indices/indices_options.smithy | 23 +++++++ 9 files changed, 154 insertions(+), 90 deletions(-) delete mode 100644 model/cat/all_pit_segments/operations.smithy delete mode 100644 model/cat/all_pit_segments/structures.smithy create mode 100644 model/cat/common_params.smithy delete mode 100644 model/cat/pit_segment.smithy create mode 100644 model/indices/indices_options.smithy diff --git a/model/cat/all_pit_segments/operations.smithy b/model/cat/all_pit_segments/operations.smithy deleted file mode 100644 index 01969215e..000000000 --- a/model/cat/all_pit_segments/operations.smithy +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// The OpenSearch Contributors require contributions made to -// this file be licensed under the Apache-2.0 license or a -// compatible open source license. - -$version: "2" -namespace OpenSearch - -@externalDocumentation( - "API Reference": "https://opensearch.org/docs/latest/search-plugins/point-in-time-api/" -) - -@xOperationGroup("cat.all_pit_segments") -@xVersionAdded("2.4") -@readonly -@suppress(["HttpUriConflict"]) -@http(method: "GET", uri: "/_cat/pit_segments/_all") -@documentation("Lists all active point-in-time segments.") -operation CatAllPitSegments { - input: CatAllPitSegments_Input, - output: CatAllPitSegments_Output -} diff --git a/model/cat/all_pit_segments/structures.smithy b/model/cat/all_pit_segments/structures.smithy deleted file mode 100644 index 3fb51cfe1..000000000 --- a/model/cat/all_pit_segments/structures.smithy +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// The OpenSearch Contributors require contributions made to -// this file be licensed under the Apache-2.0 license or a -// compatible open source license. - -$version: "2" -namespace OpenSearch - -@input -structure CatAllPitSegments_Input { -} - -@output -structure CatAllPitSegments_Output { - content: CatPitSegment -} diff --git a/model/cat/common_params.smithy b/model/cat/common_params.smithy new file mode 100644 index 000000000..49ada2e16 --- /dev/null +++ b/model/cat/common_params.smithy @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@mixin +structure CommonCatQueryParams { + @httpQuery("format") + format: Format, + + @httpQuery("h") + h: H, + + @httpQuery("help") + @default(false) + help: Help, + + @httpQuery("s") + s: S, + + @httpQuery("v") + @default(false) + v: V, +} diff --git a/model/cat/pit_segment.smithy b/model/cat/pit_segment.smithy deleted file mode 100644 index 8455974ac..000000000 --- a/model/cat/pit_segment.smithy +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// The OpenSearch Contributors require contributions made to -// this file be licensed under the Apache-2.0 license or a -// compatible open source license. - -$version: "2" -namespace OpenSearch - -structure CatPitSegment { - index: Index, - shard: Integer, - prirep: Pri, - ip: String, - segment: String , - generation: Integer, - docs_count: Integer, - docs_deleted: Integer, - size: String, - size_memory: Size, - committed: Boolean, - searchable: Boolean, - version: String, - compound: Boolean, -} diff --git a/model/cat/pit_segments/operations.smithy b/model/cat/pit_segments/operations.smithy index d44f219cf..3e5bbd2b5 100644 --- a/model/cat/pit_segments/operations.smithy +++ b/model/cat/pit_segments/operations.smithy @@ -10,7 +10,6 @@ namespace OpenSearch @externalDocumentation( "API Reference": "https://opensearch.org/docs/latest/search-plugins/point-in-time-api/" ) - @xOperationGroup("cat.pit_segments") @xVersionAdded("2.4") @readonly @@ -21,3 +20,17 @@ operation CatPitSegments { input: CatPitSegments_Input, output: CatPitSegments_Output } + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/point-in-time-api/" +) +@xOperationGroup("cat.all_pit_segments") +@xVersionAdded("2.4") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_cat/pit_segments/_all") +@documentation("Lists all active point-in-time segments.") +operation CatAllPitSegments { + input: CatAllPitSegments_Input, + output: CatAllPitSegments_Output +} diff --git a/model/cat/pit_segments/structures.smithy b/model/cat/pit_segments/structures.smithy index 953195e67..ff25f460c 100644 --- a/model/cat/pit_segments/structures.smithy +++ b/model/cat/pit_segments/structures.smithy @@ -7,6 +7,12 @@ $version: "2" namespace OpenSearch +@mixin +structure CatPitSegments_QueryParams with [CommonCatQueryParams] { + @httpQuery("bytes") + bytes: Bytes +} + structure CatPitSegments_BodyParams { @required pit_id: PitIds @@ -17,12 +23,47 @@ list PitIds{ } @input -structure CatPitSegments_Input{ +structure CatPitSegments_Input with [CatPitSegments_QueryParams] { @httpPayload - pit_id: CatPitSegments_BodyParams + content: CatPitSegments_BodyParams +} + +@input +structure CatAllPitSegments_Input with [CatPitSegments_QueryParams] { } @output structure CatPitSegments_Output { - content: CatPitSegment + @httpPayload + content: CatPitSegmentsRecords +} + +@output +structure CatAllPitSegments_Output { + @httpPayload + content: CatPitSegmentsRecords +} + +list CatPitSegmentsRecords { + member: CatPitSegmentsRecord +} + +structure CatPitSegmentsRecord { + index: String, + shard: String, + prirep: String, + ip: String, + segment: String, + generation: String, + @jsonName("docs.count") + docs_count: String, + @jsonName("docs.deleted") + docs_deleted: String, + size: String, + @jsonName("size.memory") + size_memory: String, + committed: String, + searchable: String, + version: String, + compound: String, } diff --git a/model/cat/segment_replication/operations.smithy b/model/cat/segment_replication/operations.smithy index 853fd69b2..f003c8a13 100644 --- a/model/cat/segment_replication/operations.smithy +++ b/model/cat/segment_replication/operations.smithy @@ -12,7 +12,7 @@ namespace OpenSearch ) @xOperationGroup("cat.segment_replication") -@xVersionAdded("1.0") +@xVersionAdded("2.6.0") @readonly @suppress(["HttpUriConflict"]) @http(method: "GET", uri: "/_cat/segment_replication") @@ -23,7 +23,7 @@ operation CatSegmentReplication { } @xOperationGroup("cat.segment_replication") -@xVersionAdded("1.0") +@xVersionAdded("2.6.0") @readonly @suppress(["HttpUriConflict"]) @http(method: "GET", uri: "/_cat/segment_replication/{index}") diff --git a/model/cat/segment_replication/structures.smithy b/model/cat/segment_replication/structures.smithy index 06aba99a4..0fc33c6be 100644 --- a/model/cat/segment_replication/structures.smithy +++ b/model/cat/segment_replication/structures.smithy @@ -8,10 +8,10 @@ $version: "2" namespace OpenSearch @mixin -structure CatSegmentReplication_QueryParams { - @httpQuery("format") - format: Format, - +structure CatSegmentReplication_QueryParams with [ + CommonCatQueryParams, + IndicesOptionsQueryParams, +] { @httpQuery("active_only") @documentation("If `true`, the response only includes ongoing segment replication events.") @default(false) @@ -32,26 +32,15 @@ structure CatSegmentReplication_QueryParams { @httpQuery("shards") shards: Shards, - @httpQuery("h") - h: H, - - @httpQuery("help") - @default(false) - help: Help, - @httpQuery("index") @documentation("Comma-separated list or wildcard expression of index names to limit the returned information.") query_index: Indices, - @httpQuery("s") - s: S, - @httpQuery("time") time: Time, - @httpQuery("v") - @default(false) - v: V, + @httpQuery("timeout") + timeout: Timeout, } @@ -67,5 +56,40 @@ structure CatSegmentReplication_WithIndex_Input with [CatSegmentReplication_Quer index: PathIndices, } -// TODO: Fill in Output Structure -structure CatSegmentReplication_Output {} +structure CatSegmentReplication_Output { + @httpPayload + content: CatSegmentReplicationRecords +} + +list CatSegmentReplicationRecords { + member: CatSegmentReplicationRecord +} + +structure CatSegmentReplicationRecord { + shardId: String, + target_node: String, + target_host: String, + checkpoints_behind: String, + bytes_behind: String, + current_lag: String, + last_completed_lag: String, + rejected_requests: String, + + stage: String, + time: String, + files_fetched: String, + files_percent: String, + bytes_fetched: String, + bytes_percent: String, + start_time: String, + stop_time: String, + files: String, + files_total: String, + bytes: String, + bytes_total: String, + replicating_stage_time_taken: String, + get_checkpoint_info_stage_time_taken: String, + file_diff_stage_time_taken: String, + get_files_stage_time_taken: String, + finalize_replication_stage_time_taken: String, +} diff --git a/model/indices/indices_options.smithy b/model/indices/indices_options.smithy new file mode 100644 index 000000000..b595c2e49 --- /dev/null +++ b/model/indices/indices_options.smithy @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@mixin +structure IndicesOptionsQueryParams { + @httpQuery("allow_no_indices") + allow_no_indices: AllowNoIndices, + + @httpQuery("expand_wildcards") + expand_wildcards: ExpandWildcards, + + @httpQuery("ignore_throttled") + ignore_throttled: IgnoreThrottled, + + @httpQuery("ignore_unavailable") + ignore_unavailable: IgnoreUnavailable, +} From 3375d9fc9baa5f7aedd7551c8aaf3fdbb1f402d3 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:40:54 +1300 Subject: [PATCH 19/30] Update OpenAPI specs (#187) Signed-off-by: GitHub Co-authored-by: dblock --- OpenSearch.openapi.json | 572 +++++++++++++++++++++++++++++++--------- 1 file changed, 447 insertions(+), 125 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index 982adfd49..bb15270ef 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -2632,13 +2632,80 @@ } } }, + "parameters": [ + { + "name": "format", + "in": "query", + "description": "A short version of the Accept header, e.g. json, yaml.", + "schema": { + "type": "string", + "description": "A short version of the Accept header, e.g. json, yaml." + } + }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "bytes", + "in": "query", + "description": "The unit in which to display byte values.", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + ], "responses": { "200": { "description": "CatPitSegments 200 response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CatPitSegmentsResponseContent" + "$ref": "#/components/schemas/CatPitSegmentsOutputPayload" } } } @@ -2656,13 +2723,80 @@ "url": "https://opensearch.org/docs/latest/search-plugins/point-in-time-api/" }, "operationId": "CatAllPitSegments", + "parameters": [ + { + "name": "format", + "in": "query", + "description": "A short version of the Accept header, e.g. json, yaml.", + "schema": { + "type": "string", + "description": "A short version of the Accept header, e.g. json, yaml." + } + }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "bytes", + "in": "query", + "description": "The unit in which to display byte values.", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + ], "responses": { "200": { "description": "CatAllPitSegments 200 response", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CatAllPitSegmentsResponseContent" + "$ref": "#/components/schemas/CatAllPitSegmentsOutputPayload" } } } @@ -3174,6 +3308,89 @@ "description": "A short version of the Accept header, e.g. json, yaml." } }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, { "name": "active_only", "in": "query", @@ -3226,30 +3443,6 @@ }, "explode": true }, - { - "name": "h", - "in": "query", - "description": "Comma-separated list of column names to display.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names to display." - }, - "explode": true - }, - { - "name": "help", - "in": "query", - "description": "Return help information.", - "schema": { - "type": "boolean", - "default": false, - "description": "Return help information." - } - }, { "name": "index", "in": "query", @@ -3264,20 +3457,6 @@ }, "explode": true }, - { - "name": "s", - "in": "query", - "description": "Comma-separated list of column names or column aliases to sort by.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names or column aliases to sort by." - }, - "explode": true - }, { "name": "time", "in": "query", @@ -3287,23 +3466,31 @@ } }, { - "name": "v", + "name": "timeout", "in": "query", - "description": "Verbose mode. Display column headers.", + "description": "Operation timeout.", "schema": { - "type": "boolean", - "default": false, - "description": "Verbose mode. Display column headers." + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" } } ], "responses": { "200": { - "description": "CatSegmentReplication 200 response" + "description": "CatSegmentReplication 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CatSegmentReplicationOutputPayload" + } + } + } } }, "x-operation-group": "cat.segment_replication", - "x-version-added": "1.0" + "x-version-added": "2.6.0" } }, "/_cat/segment_replication/{index}": { @@ -3332,6 +3519,89 @@ "description": "A short version of the Accept header, e.g. json, yaml." } }, + { + "name": "h", + "in": "query", + "description": "Comma-separated list of column names to display.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names to display." + }, + "explode": true + }, + { + "name": "help", + "in": "query", + "description": "Return help information.", + "schema": { + "type": "boolean", + "default": false, + "description": "Return help information." + } + }, + { + "name": "s", + "in": "query", + "description": "Comma-separated list of column names or column aliases to sort by.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of column names or column aliases to sort by." + }, + "explode": true + }, + { + "name": "v", + "in": "query", + "description": "Verbose mode. Display column headers.", + "schema": { + "type": "boolean", + "default": false, + "description": "Verbose mode. Display column headers." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, { "name": "active_only", "in": "query", @@ -3384,30 +3654,6 @@ }, "explode": true }, - { - "name": "h", - "in": "query", - "description": "Comma-separated list of column names to display.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names to display." - }, - "explode": true - }, - { - "name": "help", - "in": "query", - "description": "Return help information.", - "schema": { - "type": "boolean", - "default": false, - "description": "Return help information." - } - }, { "name": "index", "in": "query", @@ -3422,20 +3668,6 @@ }, "explode": true }, - { - "name": "s", - "in": "query", - "description": "Comma-separated list of column names or column aliases to sort by.", - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Comma-separated list of column names or column aliases to sort by." - }, - "explode": true - }, { "name": "time", "in": "query", @@ -3445,23 +3677,31 @@ } }, { - "name": "v", + "name": "timeout", "in": "query", - "description": "Verbose mode. Display column headers.", + "description": "Operation timeout.", "schema": { - "type": "boolean", - "default": false, - "description": "Verbose mode. Display column headers." + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" } } ], "responses": { "200": { - "description": "CatSegmentReplication_WithIndex 200 response" + "description": "CatSegmentReplication_WithIndex 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CatSegmentReplication_WithIndexOutputPayload" + } + } + } } }, "x-operation-group": "cat.segment_replication", - "x-version-added": "1.0" + "x-version-added": "2.6.0" } }, "/_cat/segments": { @@ -30643,27 +30883,29 @@ "pb" ] }, - "CatAllPitSegmentsResponseContent": { - "type": "object", - "properties": { - "content": { - "$ref": "#/components/schemas/CatPitSegment" - } + "CatAllPitSegmentsOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatPitSegmentsRecord" + } + }, + "CatPitSegmentsOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatPitSegmentsRecord" } }, - "CatPitSegment": { + "CatPitSegmentsRecord": { "type": "object", "properties": { "index": { "type": "string" }, "shard": { - "type": "integer", - "format": "int32" + "type": "string" }, "prirep": { - "type": "boolean", - "description": "Set to true to return stats only for primary shards." + "type": "string" }, "ip": { "type": "string" @@ -30672,43 +30914,31 @@ "type": "string" }, "generation": { - "type": "integer", - "format": "int32" + "type": "string" }, - "docs_count": { - "type": "integer", - "format": "int32" + "docs.count": { + "type": "string" }, - "docs_deleted": { - "type": "integer", - "format": "int32" + "docs.deleted": { + "type": "string" }, "size": { "type": "string" }, - "size_memory": { - "type": "integer", - "format": "int32" + "size.memory": { + "type": "string" }, "committed": { - "type": "boolean" + "type": "string" }, "searchable": { - "type": "boolean" + "type": "string" }, "version": { "type": "string" }, "compound": { - "type": "boolean" - } - } - }, - "CatPitSegmentsResponseContent": { - "type": "object", - "properties": { - "content": { - "$ref": "#/components/schemas/CatPitSegment" + "type": "string" } } }, @@ -30726,6 +30956,98 @@ "pit_id" ] }, + "CatSegmentReplicationOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatSegmentReplicationRecord" + } + }, + "CatSegmentReplicationRecord": { + "type": "object", + "properties": { + "shardId": { + "type": "string" + }, + "target_node": { + "type": "string" + }, + "target_host": { + "type": "string" + }, + "checkpoints_behind": { + "type": "string" + }, + "bytes_behind": { + "type": "string" + }, + "current_lag": { + "type": "string" + }, + "last_completed_lag": { + "type": "string" + }, + "rejected_requests": { + "type": "string" + }, + "stage": { + "type": "string" + }, + "time": { + "type": "string" + }, + "files_fetched": { + "type": "string" + }, + "files_percent": { + "type": "string" + }, + "bytes_fetched": { + "type": "string" + }, + "bytes_percent": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "stop_time": { + "type": "string" + }, + "files": { + "type": "string" + }, + "files_total": { + "type": "string" + }, + "bytes": { + "type": "string" + }, + "bytes_total": { + "type": "string" + }, + "replicating_stage_time_taken": { + "type": "string" + }, + "get_checkpoint_info_stage_time_taken": { + "type": "string" + }, + "file_diff_stage_time_taken": { + "type": "string" + }, + "get_files_stage_time_taken": { + "type": "string" + }, + "finalize_replication_stage_time_taken": { + "type": "string" + } + } + }, + "CatSegmentReplication_WithIndexOutputPayload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatSegmentReplicationRecord" + } + }, "CertificatesDetail": { "type": "object", "properties": { From 178705681e5fd812ab59ad00cefa04146d03d7ad Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 29 Jan 2024 11:03:11 -0500 Subject: [PATCH 20/30] Remove unnecessary trailing slashes. (#186) Signed-off-by: dblock --- OpenSearch.openapi.json | 48 +++++++++---------- .../operations.smithy | 2 +- .../get_action_groups/operations.smithy | 2 +- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index bb15270ef..79b20b7c8 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -5139,7 +5139,7 @@ "x-version-added": "1.0" } }, - "/_cluster/decommission/awareness/": { + "/_cluster/decommission/awareness": { "delete": { "description": "Delete any existing decommission.", "externalDocs": { @@ -12067,6 +12067,28 @@ } }, "/_plugins/_security/api/actiongroups": { + "get": { + "description": "Retrieves all action groups.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/security/access-control/api/#get-action-groups" + }, + "operationId": "GetActionGroups", + "responses": { + "200": { + "description": "GetActionGroups 200 response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ActionGroupsMap" + } + } + } + } + }, + "x-operation-group": "security.get_action_groups", + "x-version-added": "1.0" + }, "patch": { "description": "Creates, updates, or deletes multiple action groups in a single call.", "externalDocs": { @@ -12100,30 +12122,6 @@ "x-version-added": "1.0" } }, - "/_plugins/_security/api/actiongroups/": { - "get": { - "description": "Retrieves all action groups.", - "externalDocs": { - "description": "API Reference", - "url": "https://opensearch.org/docs/latest/security/access-control/api/#get-action-groups" - }, - "operationId": "GetActionGroups", - "responses": { - "200": { - "description": "GetActionGroups 200 response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActionGroupsMap" - } - } - } - } - }, - "x-operation-group": "security.get_action_groups", - "x-version-added": "1.0" - } - }, "/_plugins/_security/api/actiongroups/{action_group}": { "delete": { "description": "Delete a specified action group.", diff --git a/model/cluster/delete_decommission_awareness/operations.smithy b/model/cluster/delete_decommission_awareness/operations.smithy index e3d0364ba..78caee215 100644 --- a/model/cluster/delete_decommission_awareness/operations.smithy +++ b/model/cluster/delete_decommission_awareness/operations.smithy @@ -15,7 +15,7 @@ namespace OpenSearch @xVersionAdded("1.0") @idempotent @suppress(["HttpUriConflict"]) -@http(method: "DELETE", uri: "/_cluster/decommission/awareness/") +@http(method: "DELETE", uri: "/_cluster/decommission/awareness") @documentation("Delete any existing decommission.") operation ClusterDeleteDecommissionAwareness { input: ClusterDeleteDecommissionAwareness_Input, diff --git a/model/security/get_action_groups/operations.smithy b/model/security/get_action_groups/operations.smithy index 69e063652..605eca625 100644 --- a/model/security/get_action_groups/operations.smithy +++ b/model/security/get_action_groups/operations.smithy @@ -15,7 +15,7 @@ namespace OpenSearch @xVersionAdded("1.0") @readonly @suppress(["HttpUriConflict"]) -@http(method: "GET", uri: "/_plugins/_security/api/actiongroups/") +@http(method: "GET", uri: "/_plugins/_security/api/actiongroups") @documentation("Retrieves all action groups.") operation GetActionGroups { input: GetActionGroups_Input, From a39ba07f7a6da414b283a7dd702406e86dcb42c6 Mon Sep 17 00:00:00 2001 From: Theo Nam Truong Date: Mon, 26 Feb 2024 12:37:36 -0700 Subject: [PATCH 21/30] Locked OpenSearch CI cluster to version 2.11.1 (#193) Signed-off-by: Theo Truong --- test/opensearch/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/opensearch/Dockerfile b/test/opensearch/Dockerfile index 569375bfb..01c073740 100644 --- a/test/opensearch/Dockerfile +++ b/test/opensearch/Dockerfile @@ -1,7 +1,7 @@ -FROM opensearchproject/opensearch:latest +FROM opensearchproject/opensearch:2.11.1 USER root RUN mkdir -p /mnt/snapshots && chown -R opensearch:opensearch /mnt/snapshots USER opensearch -VOLUME /mnt/snapshots \ No newline at end of file +VOLUME /mnt/snapshots From 21b3e2bacce53649648055b3e1378f989bcde4a8 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Wed, 6 Mar 2024 17:07:35 -0500 Subject: [PATCH 22/30] Adds API spec coverage report. (#179) * Added API spec coverage. Signed-off-by: dblock --- .github/workflows/coverage.yml | 42 ++++++++++++++++++++++++++++++++++ coverage/Dockerfile | 7 ++++++ coverage/README.md | 7 ++++++ 3 files changed, 56 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 coverage/Dockerfile create mode 100644 coverage/README.md diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..922176c9e --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,42 @@ +name: API Coverage + +on: [push, pull_request] + +env: + JAVA_VERSION: 11 + OPENSEARCH_INITIAL_ADMIN_PASSWORD: BobgG7YrtsdKf9M + +jobs: + coverage: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Build and Run Docker Container + run: | + docker build coverage --tag opensearch-with-api-plugin + docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e OPENSEARCH_INITIAL_ADMIN_PASSWORD="$OPENSEARCH_INITIAL_ADMIN_PASSWORD" opensearch-with-api-plugin + sleep 15 + - name: Display OpenSearch Info + run: | + curl -ks -u "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" https://localhost:9200/ | jq + - name: Dump and Compare API + run: | + curl -ks -u "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" https://localhost:9200/_plugins/api | jq > OpenSearch.auto.openapi.json + docker run --rm --mount type=bind,source=.,target=/specs openapitools/openapi-diff:latest /specs/OpenSearch.openapi.json /specs/OpenSearch.auto.openapi.json --json /specs/diff.json + - name: Show Diff + run: | + echo "-------- Missing APIs" + jq -r '.newEndpoints | group_by(.pathUrl)[] | "\(.[0].pathUrl): \([.[].method])"' diff.json + echo "-------- Legacy APIs" + jq -r '.missingEndpoints | group_by(.pathUrl)[] | "\(.[0].pathUrl): \([.[].method])"' diff.json + - name: Gather Coverage + id: coverage + shell: bash + run: | + current=`jq -r '.paths | keys | length' OpenSearch.openapi.json` + total=`jq -r '.paths | keys | length' OpenSearch.auto.openapi.json` + percent=$((current * 100 / total)) + echo "API specs implemented for $current/$total ($percent%) APIs." diff --git a/coverage/Dockerfile b/coverage/Dockerfile new file mode 100644 index 000000000..3f34b3b3b --- /dev/null +++ b/coverage/Dockerfile @@ -0,0 +1,7 @@ +ARG OPENSEARCH_VERSION=2.12.0 +FROM opensearchproject/opensearch:${OPENSEARCH_VERSION} +ARG OPENSEARCH_VERSION +RUN /usr/share/opensearch/bin/opensearch-plugin \ + install \ + --batch \ + https://github.com/dblock/opensearch-api/releases/download/v${OPENSEARCH_VERSION}/opensearch-api-${OPENSEARCH_VERSION}.0.zip diff --git a/coverage/README.md b/coverage/README.md new file mode 100644 index 000000000..f88aca974 --- /dev/null +++ b/coverage/README.md @@ -0,0 +1,7 @@ +### API Coverage + +Uses the [opensearch-api plugin](https://github.com/dblock/opensearch-api), and [openapi-diff](https://github.com/OpenAPITools/openapi-diff) to show the difference between OpenSearch APIs, and the [OpenAPI spec checked into this repo](../OpenSearch.openapi.json). + +API coverage is run on all pull requests via the [coverage workflow](../.github/workflows/coverage.yml). + + From 875cad1f30ddd7edda8de0700e7b53d160fa67d0 Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Thu, 7 Mar 2024 06:15:42 -0800 Subject: [PATCH 23/30] Added K-NN APIs get_model, search_model, delete_model, train_model (#192) * Added Knn APIs get_model, search_model, delete_model, train_model Signed-off-by: saimedhi * Added Knn APIs get_model, search_model, delete_model, train_model Signed-off-by: saimedhi * Added spec for k-NN apis Signed-off-by: saimedhi * Added spec for k-NN apis Signed-off-by: saimedhi --------- Signed-off-by: saimedhi --- model/common_strings.smithy | 7 + model/knn/delete_model/operations.smithy | 23 ++++ model/knn/delete_model/structures.smithy | 18 +++ model/knn/get_model/operations.smithy | 23 ++++ model/knn/get_model/structures.smithy | 18 +++ model/knn/search_model/operations.smithy | 33 +++++ model/knn/search_model/structures.smithy | 167 +++++++++++++++++++++++ model/knn/train_model/operations.smithy | 32 +++++ model/knn/train_model/structures.smithy | 55 ++++++++ model/opensearch.smithy | 6 + 10 files changed, 382 insertions(+) create mode 100644 model/knn/delete_model/operations.smithy create mode 100644 model/knn/delete_model/structures.smithy create mode 100644 model/knn/get_model/operations.smithy create mode 100644 model/knn/get_model/structures.smithy create mode 100644 model/knn/search_model/operations.smithy create mode 100644 model/knn/search_model/structures.smithy create mode 100644 model/knn/train_model/operations.smithy create mode 100644 model/knn/train_model/structures.smithy diff --git a/model/common_strings.smithy b/model/common_strings.smithy index b6a2c928c..a2021587e 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -247,6 +247,10 @@ string PathTaskId @documentation("The name of the template.") string PathTemplateName +@pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") +@documentation("The id of the model.") +string PathModelId + @documentation("The analyzer to use for the query string.") string Analyzer @@ -281,6 +285,9 @@ string Lang @documentation("Comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names.") string NodeIds +@documentation("Preferred node to execute training.") +string NodeId + @documentation("Comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids.") string NodeNames diff --git a/model/knn/delete_model/operations.smithy b/model/knn/delete_model/operations.smithy new file mode 100644 index 000000000..7bc4459f2 --- /dev/null +++ b/model/knn/delete_model/operations.smithy @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#delete-model" +) + +@xOperationGroup("knn.delete_model") +@xVersionAdded("1.0") +@suppress(["HttpMethodSemantics.UnexpectedPayload"]) +@suppress(["HttpUriConflict"]) +@http(method: "DELETE", uri: "/_plugins/_knn/models/{model_id}") +@documentation("Used to delete a particular model in the cluster.") +operation KNNDeleteModel { + input: KNNDeleteModel_Input, + output: KNNDeleteModel_Output +} diff --git a/model/knn/delete_model/structures.smithy b/model/knn/delete_model/structures.smithy new file mode 100644 index 000000000..2f9fe30e0 --- /dev/null +++ b/model/knn/delete_model/structures.smithy @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@input +structure KNNDeleteModel_Input { + @required + @httpLabel + model_id: PathModelId, +} + +// TODO: Fill in Output Structure +structure KNNDeleteModel_Output {} diff --git a/model/knn/get_model/operations.smithy b/model/knn/get_model/operations.smithy new file mode 100644 index 000000000..557678686 --- /dev/null +++ b/model/knn/get_model/operations.smithy @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#get-model" +) + +@xOperationGroup("knn.get_model") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/models/{model_id}") +@documentation("Used to retrieve information about models present in the cluster.") +operation KNNGetModel { + input: KNNGetModel_Input, + output: KNNGetModel_Output +} diff --git a/model/knn/get_model/structures.smithy b/model/knn/get_model/structures.smithy new file mode 100644 index 000000000..ad0bafd49 --- /dev/null +++ b/model/knn/get_model/structures.smithy @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@input +structure KNNGetModel_Input { + @required + @httpLabel + model_id: PathModelId, +} + +// TODO: Fill in Output Structure +structure KNNGetModel_Output {} diff --git a/model/knn/search_model/operations.smithy b/model/knn/search_model/operations.smithy new file mode 100644 index 000000000..a6becc931 --- /dev/null +++ b/model/knn/search_model/operations.smithy @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#search-model" +) + +@xOperationGroup("knn.search_models") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/models/_search") +@documentation("Use an OpenSearch query to search for models in the index.") +operation KNNSearchModels_Get { + input: KNNSearchModels_Get_Input, + output: KNNSearchModels_Output +} + +@xOperationGroup("knn.search_models") +@xVersionAdded("1.0") +@suppress(["HttpUriConflict"]) +@http(method: "POST", uri: "/_plugins/_knn/models/_search") +@documentation("Use an OpenSearch query to search for models in the index.") +operation KNNSearchModels_Post { + input: KNNSearchModels_Post_Input, + output: KNNSearchModels_Output +} diff --git a/model/knn/search_model/structures.smithy b/model/knn/search_model/structures.smithy new file mode 100644 index 000000000..c21a945f4 --- /dev/null +++ b/model/knn/search_model/structures.smithy @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@mixin +structure KNNSearchModels_QueryParams { + @httpQuery("analyzer") + analyzer: Analyzer, + + @httpQuery("analyze_wildcard") + @default(false) + analyze_wildcard: AnalyzeWildcard, + + @httpQuery("ccs_minimize_roundtrips") + @default(true) + ccs_minimize_roundtrips: CcsMinimizeRoundtrips, + + @httpQuery("default_operator") + @default("OR") + default_operator: DefaultOperator, + + @httpQuery("df") + df: Df, + + @httpQuery("explain") + @documentation("Specify whether to return detailed information about score computation as part of a hit.") + explain: Explain, + + @httpQuery("stored_fields") + stored_fields: StoredFields, + + @httpQuery("docvalue_fields") + docvalue_fields: DocvalueFields, + + @httpQuery("from") + @default(0) + from: From, + + @httpQuery("ignore_unavailable") + ignore_unavailable: IgnoreUnavailable, + + @httpQuery("ignore_throttled") + ignore_throttled: IgnoreThrottled, + + @httpQuery("allow_no_indices") + allow_no_indices: AllowNoIndices, + + @httpQuery("expand_wildcards") + @default("open") + expand_wildcards: ExpandWildcards, + + @httpQuery("lenient") + lenient: Lenient, + + @httpQuery("preference") + @default("random") + preference: Preference, + + @httpQuery("q") + q: Q, + + @httpQuery("routing") + routing: Routings, + + @httpQuery("scroll") + scroll: Scroll, + + @httpQuery("search_type") + search_type: SearchType, + + @httpQuery("size") + @documentation("Number of hits to return.") + @default(10) + size: Size, + + @httpQuery("sort") + sort: Sort, + + @httpQuery("_source") + _source: Source, + + @httpQuery("_source_excludes") + _source_excludes: SourceExcludes, + + @httpQuery("_source_includes") + _source_includes: SourceIncludes, + + @httpQuery("terminate_after") + terminate_after: TerminateAfter, + + @httpQuery("stats") + stats: Stats, + + @httpQuery("suggest_field") + suggest_field: SuggestField, + + @httpQuery("suggest_mode") + @default("missing") + suggest_mode: SuggestMode, + + @httpQuery("suggest_size") + suggest_size: SuggestSize, + + @httpQuery("suggest_text") + suggest_text: SuggestText, + + @httpQuery("timeout") + timeout: Timeout, + + @httpQuery("track_scores") + track_scores: TrackScores, + + @httpQuery("track_total_hits") + track_total_hits: TrackTotalHits, + + @httpQuery("allow_partial_search_results") + @default(true) + allow_partial_search_results: AllowPartialSearchResults, + + @httpQuery("typed_keys") + typed_keys: TypedKeys, + + @httpQuery("version") + version: WithVersion, + + @httpQuery("seq_no_primary_term") + seq_no_primary_term: SeqNoPrimaryTerm, + + @httpQuery("request_cache") + request_cache: RequestCache, + + @httpQuery("batched_reduce_size") + @default(512) + batched_reduce_size: BatchedReduceSize, + + @httpQuery("max_concurrent_shard_requests") + @documentation("The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.") + @default(5) + max_concurrent_shard_requests: MaxConcurrentShardRequests, + + @httpQuery("pre_filter_shard_size") + pre_filter_shard_size: PreFilterShardSize, + + @httpQuery("rest_total_hits_as_int") + @default(false) + rest_total_hits_as_int: RestTotalHitsAsInt, +} + +// TODO: Fill in Body Parameters +structure KNNSearchModels_BodyParams {} + +@input +structure KNNSearchModels_Get_Input with [KNNSearchModels_QueryParams] {} + +@input +structure KNNSearchModels_Post_Input with [KNNSearchModels_QueryParams] { + @httpPayload + content: KNNSearchModels_BodyParams, +} + +// TODO: Fill in Output Structure +structure KNNSearchModels_Output {} diff --git a/model/knn/train_model/operations.smithy b/model/knn/train_model/operations.smithy new file mode 100644 index 000000000..a65032765 --- /dev/null +++ b/model/knn/train_model/operations.smithy @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#train-model" +) + +@xOperationGroup("knn.train_model") +@xVersionAdded("1.0") +@suppress(["HttpUriConflict"]) +@http(method: "POST", uri: "/_plugins/_knn/models/_train") +@documentation("Create and train a model that can be used for initializing k-NN native library indexes during indexing.") +operation KNNTrainModel { + input: KNNTrainModel_Input, + output: KNNTrainModel_Output +} + +@xOperationGroup("knn.train_model") +@xVersionAdded("1.0") +@suppress(["HttpUriConflict"]) +@http(method: "POST", uri: "/_plugins/_knn/models/{model_id}/_train") +@documentation("Create and train a model that can be used for initializing k-NN native library indexes during indexing.") +operation KNNTrainModel_WithModelId { + input: KNNTrainModel_WithModelId_Input, + output: KNNTrainModel_Output +} diff --git a/model/knn/train_model/structures.smithy b/model/knn/train_model/structures.smithy new file mode 100644 index 000000000..096667250 --- /dev/null +++ b/model/knn/train_model/structures.smithy @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@mixin +structure KNNTrainModel_QueryParams { + @httpQuery("preference") + preference: NodeId, +} + +structure KNNTrainModel_BodyParams { + @required + training_index: String, + + @required + training_field: String, + + @required + dimension: Integer, + + max_training_vector_count: Integer, + + search_size: Integer, + + description: String, + + @required + method: String, +} + +@input +structure KNNTrainModel_Input with [KNNTrainModel_QueryParams] { + @required + @httpPayload + content: KNNTrainModel_BodyParams, +} + +@input +structure KNNTrainModel_WithModelId_Input with [KNNTrainModel_QueryParams] { + @required + @httpPayload + content: KNNTrainModel_BodyParams, + + @required + @httpLabel + model_id: PathModelId, +} + +// TODO: Fill in Output Structure +structure KNNTrainModel_Output {} diff --git a/model/opensearch.smithy b/model/opensearch.smithy index ccb6b3805..e8a1b55bc 100644 --- a/model/opensearch.smithy +++ b/model/opensearch.smithy @@ -256,6 +256,12 @@ service OpenSearch { IngestSimulate_Get_WithId, IngestSimulate_Post, IngestSimulate_Post_WithId, + KNNDeleteModel, + KNNGetModel, + KNNSearchModels_Get, + KNNSearchModels_Post, + KNNTrainModel, + KNNTrainModel_WithModelId, Mget_Get, Mget_Get_WithIndex, Mget_Post, From f521197114ea869311b81d0dc8c9c9aa65b66e37 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:19:38 +1300 Subject: [PATCH 24/30] Update OpenAPI specs (#197) Signed-off-by: GitHub Co-authored-by: dblock --- OpenSearch.openapi.json | 1088 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 1088 insertions(+) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index 79b20b7c8..b81b9276f 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -12010,6 +12010,1056 @@ "x-version-added": "1.0" } }, + "/_plugins/_knn/models/_search": { + "get": { + "description": "Use an OpenSearch query to search for models in the index.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#search-model" + }, + "operationId": "KNNSearchModels_Get", + "parameters": [ + { + "name": "analyzer", + "in": "query", + "description": "The analyzer to use for the query string.", + "schema": { + "type": "string", + "description": "The analyzer to use for the query string." + } + }, + { + "name": "analyze_wildcard", + "in": "query", + "description": "Specify whether wildcard and prefix queries should be analyzed.", + "schema": { + "type": "boolean", + "default": false, + "description": "Specify whether wildcard and prefix queries should be analyzed." + } + }, + { + "name": "ccs_minimize_roundtrips", + "in": "query", + "description": "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution.", + "schema": { + "type": "boolean", + "default": true, + "description": "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution." + } + }, + { + "name": "default_operator", + "in": "query", + "description": "The default operator for query string query (AND or OR).", + "schema": { + "$ref": "#/components/schemas/DefaultOperator" + } + }, + { + "name": "df", + "in": "query", + "description": "The field to use as default where no field prefix is given in the query string.", + "schema": { + "type": "string", + "description": "The field to use as default where no field prefix is given in the query string." + } + }, + { + "name": "explain", + "in": "query", + "description": "Specify whether to return detailed information about score computation as part of a hit.", + "schema": { + "type": "boolean", + "description": "Specify whether to return detailed information about score computation as part of a hit." + } + }, + { + "name": "stored_fields", + "in": "query", + "description": "Comma-separated list of stored fields to return.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of stored fields to return." + }, + "explode": true + }, + { + "name": "docvalue_fields", + "in": "query", + "description": "Comma-separated list of fields to return as the docvalue representation of a field for each hit.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of fields to return as the docvalue representation of a field for each hit." + }, + "explode": true + }, + { + "name": "from", + "in": "query", + "description": "Starting offset.", + "schema": { + "type": "integer", + "default": 0, + "description": "Starting offset.", + "format": "int32" + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "lenient", + "in": "query", + "description": "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored.", + "schema": { + "type": "boolean", + "description": "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored." + } + }, + { + "name": "preference", + "in": "query", + "description": "Specify the node or shard the operation should be performed on.", + "schema": { + "type": "string", + "default": "random", + "description": "Specify the node or shard the operation should be performed on." + } + }, + { + "name": "q", + "in": "query", + "description": "Query in the Lucene query string syntax.", + "schema": { + "type": "string", + "description": "Query in the Lucene query string syntax." + } + }, + { + "name": "routing", + "in": "query", + "description": "Comma-separated list of specific routing values.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of specific routing values." + }, + "explode": true + }, + { + "name": "scroll", + "in": "query", + "description": "Specify how long a consistent view of the index should be maintained for scrolled search.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Specify how long a consistent view of the index should be maintained for scrolled search.", + "x-data-type": "time" + } + }, + { + "name": "search_type", + "in": "query", + "description": "Search operation type.", + "schema": { + "$ref": "#/components/schemas/SearchType" + } + }, + { + "name": "size", + "in": "query", + "description": "Number of hits to return.", + "schema": { + "type": "integer", + "default": 10, + "description": "Number of hits to return.", + "format": "int32" + } + }, + { + "name": "sort", + "in": "query", + "description": "Comma-separated list of : pairs.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of : pairs." + }, + "explode": true + }, + { + "name": "_source", + "in": "query", + "description": "True or false to return the _source field or not, or a list of fields to return.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "True or false to return the _source field or not, or a list of fields to return." + }, + "explode": true + }, + { + "name": "_source_excludes", + "in": "query", + "description": "List of fields to exclude from the returned _source field.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of fields to exclude from the returned _source field." + }, + "explode": true + }, + { + "name": "_source_includes", + "in": "query", + "description": "List of fields to extract and return from the _source field.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of fields to extract and return from the _source field." + }, + "explode": true + }, + { + "name": "terminate_after", + "in": "query", + "description": "The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.", + "schema": { + "type": "integer", + "description": "The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.", + "format": "int32" + } + }, + { + "name": "stats", + "in": "query", + "description": "Specific 'tag' of the request for logging and statistical purposes.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Specific 'tag' of the request for logging and statistical purposes." + }, + "explode": true + }, + { + "name": "suggest_field", + "in": "query", + "description": "Specify which field to use for suggestions.", + "schema": { + "type": "string", + "description": "Specify which field to use for suggestions." + } + }, + { + "name": "suggest_mode", + "in": "query", + "description": "Specify suggest mode.", + "schema": { + "$ref": "#/components/schemas/SuggestMode" + } + }, + { + "name": "suggest_size", + "in": "query", + "description": "How many suggestions to return in response.", + "schema": { + "type": "integer", + "description": "How many suggestions to return in response.", + "format": "int32" + } + }, + { + "name": "suggest_text", + "in": "query", + "description": "The source text for which the suggestions should be returned.", + "schema": { + "type": "string", + "description": "The source text for which the suggestions should be returned." + } + }, + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + }, + { + "name": "track_scores", + "in": "query", + "description": "Whether to calculate and return scores even if they are not used for sorting.", + "schema": { + "type": "boolean", + "description": "Whether to calculate and return scores even if they are not used for sorting." + } + }, + { + "name": "track_total_hits", + "in": "query", + "description": "Indicate if the number of documents that match the query should be tracked.", + "schema": { + "type": "boolean", + "description": "Indicate if the number of documents that match the query should be tracked." + } + }, + { + "name": "allow_partial_search_results", + "in": "query", + "description": "Indicate if an error should be returned if there is a partial search failure or timeout.", + "schema": { + "type": "boolean", + "default": true, + "description": "Indicate if an error should be returned if there is a partial search failure or timeout." + } + }, + { + "name": "typed_keys", + "in": "query", + "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response.", + "schema": { + "type": "boolean", + "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response." + } + }, + { + "name": "version", + "in": "query", + "description": "Whether to return document version as part of a hit.", + "schema": { + "type": "boolean", + "description": "Whether to return document version as part of a hit." + } + }, + { + "name": "seq_no_primary_term", + "in": "query", + "description": "Specify whether to return sequence number and primary term of the last modification of each hit.", + "schema": { + "type": "boolean", + "description": "Specify whether to return sequence number and primary term of the last modification of each hit." + } + }, + { + "name": "request_cache", + "in": "query", + "description": "Specify if request cache should be used for this request or not, defaults to index level setting.", + "schema": { + "type": "boolean", + "description": "Specify if request cache should be used for this request or not, defaults to index level setting." + } + }, + { + "name": "batched_reduce_size", + "in": "query", + "description": "The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.", + "schema": { + "type": "integer", + "default": 512, + "description": "The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.", + "format": "int32" + } + }, + { + "name": "max_concurrent_shard_requests", + "in": "query", + "description": "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.", + "schema": { + "type": "integer", + "default": 5, + "description": "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.", + "format": "int32" + } + }, + { + "name": "pre_filter_shard_size", + "in": "query", + "description": "Threshold that enforces a pre-filter round-trip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter round-trip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.", + "schema": { + "type": "integer", + "description": "Threshold that enforces a pre-filter round-trip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter round-trip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.", + "format": "int32" + } + }, + { + "name": "rest_total_hits_as_int", + "in": "query", + "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response.", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." + } + } + ], + "responses": { + "200": { + "description": "KNNSearchModels_Get 200 response" + } + }, + "x-operation-group": "knn.search_models", + "x-version-added": "1.0" + }, + "post": { + "description": "Use an OpenSearch query to search for models in the index.", + "operationId": "KNNSearchModels_Post", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KNNSearchModels_BodyParams" + } + } + } + }, + "parameters": [ + { + "name": "analyzer", + "in": "query", + "description": "The analyzer to use for the query string.", + "schema": { + "type": "string", + "description": "The analyzer to use for the query string." + } + }, + { + "name": "analyze_wildcard", + "in": "query", + "description": "Specify whether wildcard and prefix queries should be analyzed.", + "schema": { + "type": "boolean", + "default": false, + "description": "Specify whether wildcard and prefix queries should be analyzed." + } + }, + { + "name": "ccs_minimize_roundtrips", + "in": "query", + "description": "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution.", + "schema": { + "type": "boolean", + "default": true, + "description": "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution." + } + }, + { + "name": "default_operator", + "in": "query", + "description": "The default operator for query string query (AND or OR).", + "schema": { + "$ref": "#/components/schemas/DefaultOperator" + } + }, + { + "name": "df", + "in": "query", + "description": "The field to use as default where no field prefix is given in the query string.", + "schema": { + "type": "string", + "description": "The field to use as default where no field prefix is given in the query string." + } + }, + { + "name": "explain", + "in": "query", + "description": "Specify whether to return detailed information about score computation as part of a hit.", + "schema": { + "type": "boolean", + "description": "Specify whether to return detailed information about score computation as part of a hit." + } + }, + { + "name": "stored_fields", + "in": "query", + "description": "Comma-separated list of stored fields to return.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of stored fields to return." + }, + "explode": true + }, + { + "name": "docvalue_fields", + "in": "query", + "description": "Comma-separated list of fields to return as the docvalue representation of a field for each hit.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of fields to return as the docvalue representation of a field for each hit." + }, + "explode": true + }, + { + "name": "from", + "in": "query", + "description": "Starting offset.", + "schema": { + "type": "integer", + "default": 0, + "description": "Starting offset.", + "format": "int32" + } + }, + { + "name": "ignore_unavailable", + "in": "query", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed).", + "schema": { + "type": "boolean", + "description": "Whether specified concrete indices should be ignored when unavailable (missing or closed)." + } + }, + { + "name": "ignore_throttled", + "in": "query", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled.", + "schema": { + "type": "boolean", + "description": "Whether specified concrete, expanded or aliased indices should be ignored when throttled." + } + }, + { + "name": "allow_no_indices", + "in": "query", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified).", + "schema": { + "type": "boolean", + "description": "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)." + } + }, + { + "name": "expand_wildcards", + "in": "query", + "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both.", + "schema": { + "$ref": "#/components/schemas/ExpandWildcards" + } + }, + { + "name": "lenient", + "in": "query", + "description": "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored.", + "schema": { + "type": "boolean", + "description": "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored." + } + }, + { + "name": "preference", + "in": "query", + "description": "Specify the node or shard the operation should be performed on.", + "schema": { + "type": "string", + "default": "random", + "description": "Specify the node or shard the operation should be performed on." + } + }, + { + "name": "q", + "in": "query", + "description": "Query in the Lucene query string syntax.", + "schema": { + "type": "string", + "description": "Query in the Lucene query string syntax." + } + }, + { + "name": "routing", + "in": "query", + "description": "Comma-separated list of specific routing values.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of specific routing values." + }, + "explode": true + }, + { + "name": "scroll", + "in": "query", + "description": "Specify how long a consistent view of the index should be maintained for scrolled search.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Specify how long a consistent view of the index should be maintained for scrolled search.", + "x-data-type": "time" + } + }, + { + "name": "search_type", + "in": "query", + "description": "Search operation type.", + "schema": { + "$ref": "#/components/schemas/SearchType" + } + }, + { + "name": "size", + "in": "query", + "description": "Number of hits to return.", + "schema": { + "type": "integer", + "default": 10, + "description": "Number of hits to return.", + "format": "int32" + } + }, + { + "name": "sort", + "in": "query", + "description": "Comma-separated list of : pairs.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Comma-separated list of : pairs." + }, + "explode": true + }, + { + "name": "_source", + "in": "query", + "description": "True or false to return the _source field or not, or a list of fields to return.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "True or false to return the _source field or not, or a list of fields to return." + }, + "explode": true + }, + { + "name": "_source_excludes", + "in": "query", + "description": "List of fields to exclude from the returned _source field.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of fields to exclude from the returned _source field." + }, + "explode": true + }, + { + "name": "_source_includes", + "in": "query", + "description": "List of fields to extract and return from the _source field.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of fields to extract and return from the _source field." + }, + "explode": true + }, + { + "name": "terminate_after", + "in": "query", + "description": "The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.", + "schema": { + "type": "integer", + "description": "The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.", + "format": "int32" + } + }, + { + "name": "stats", + "in": "query", + "description": "Specific 'tag' of the request for logging and statistical purposes.", + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Specific 'tag' of the request for logging and statistical purposes." + }, + "explode": true + }, + { + "name": "suggest_field", + "in": "query", + "description": "Specify which field to use for suggestions.", + "schema": { + "type": "string", + "description": "Specify which field to use for suggestions." + } + }, + { + "name": "suggest_mode", + "in": "query", + "description": "Specify suggest mode.", + "schema": { + "$ref": "#/components/schemas/SuggestMode" + } + }, + { + "name": "suggest_size", + "in": "query", + "description": "How many suggestions to return in response.", + "schema": { + "type": "integer", + "description": "How many suggestions to return in response.", + "format": "int32" + } + }, + { + "name": "suggest_text", + "in": "query", + "description": "The source text for which the suggestions should be returned.", + "schema": { + "type": "string", + "description": "The source text for which the suggestions should be returned." + } + }, + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + }, + { + "name": "track_scores", + "in": "query", + "description": "Whether to calculate and return scores even if they are not used for sorting.", + "schema": { + "type": "boolean", + "description": "Whether to calculate and return scores even if they are not used for sorting." + } + }, + { + "name": "track_total_hits", + "in": "query", + "description": "Indicate if the number of documents that match the query should be tracked.", + "schema": { + "type": "boolean", + "description": "Indicate if the number of documents that match the query should be tracked." + } + }, + { + "name": "allow_partial_search_results", + "in": "query", + "description": "Indicate if an error should be returned if there is a partial search failure or timeout.", + "schema": { + "type": "boolean", + "default": true, + "description": "Indicate if an error should be returned if there is a partial search failure or timeout." + } + }, + { + "name": "typed_keys", + "in": "query", + "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response.", + "schema": { + "type": "boolean", + "description": "Specify whether aggregation and suggester names should be prefixed by their respective types in the response." + } + }, + { + "name": "version", + "in": "query", + "description": "Whether to return document version as part of a hit.", + "schema": { + "type": "boolean", + "description": "Whether to return document version as part of a hit." + } + }, + { + "name": "seq_no_primary_term", + "in": "query", + "description": "Specify whether to return sequence number and primary term of the last modification of each hit.", + "schema": { + "type": "boolean", + "description": "Specify whether to return sequence number and primary term of the last modification of each hit." + } + }, + { + "name": "request_cache", + "in": "query", + "description": "Specify if request cache should be used for this request or not, defaults to index level setting.", + "schema": { + "type": "boolean", + "description": "Specify if request cache should be used for this request or not, defaults to index level setting." + } + }, + { + "name": "batched_reduce_size", + "in": "query", + "description": "The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.", + "schema": { + "type": "integer", + "default": 512, + "description": "The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.", + "format": "int32" + } + }, + { + "name": "max_concurrent_shard_requests", + "in": "query", + "description": "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.", + "schema": { + "type": "integer", + "default": 5, + "description": "The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.", + "format": "int32" + } + }, + { + "name": "pre_filter_shard_size", + "in": "query", + "description": "Threshold that enforces a pre-filter round-trip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter round-trip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.", + "schema": { + "type": "integer", + "description": "Threshold that enforces a pre-filter round-trip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter round-trip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.", + "format": "int32" + } + }, + { + "name": "rest_total_hits_as_int", + "in": "query", + "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response.", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response." + } + } + ], + "responses": { + "200": { + "description": "KNNSearchModels_Post 200 response" + } + }, + "x-operation-group": "knn.search_models", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/models/_train": { + "post": { + "description": "Create and train a model that can be used for initializing k-NN native library indexes during indexing.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#train-model" + }, + "operationId": "KNNTrainModel", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KNNTrainModel_BodyParams" + } + } + }, + "required": true + }, + "parameters": [ + { + "name": "preference", + "in": "query", + "description": "Preferred node to execute training.", + "schema": { + "type": "string", + "description": "Preferred node to execute training." + } + } + ], + "responses": { + "200": { + "description": "KNNTrainModel 200 response" + } + }, + "x-operation-group": "knn.train_model", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/models/{model_id}": { + "delete": { + "description": "Used to delete a particular model in the cluster.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#delete-model" + }, + "operationId": "KNNDeleteModel", + "parameters": [ + { + "name": "model_id", + "in": "path", + "description": "The id of the model.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "The id of the model." + }, + "required": true + } + ], + "responses": { + "200": { + "description": "KNNDeleteModel 200 response" + } + }, + "x-operation-group": "knn.delete_model", + "x-version-added": "1.0" + }, + "get": { + "description": "Used to retrieve information about models present in the cluster.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#get-model" + }, + "operationId": "KNNGetModel", + "parameters": [ + { + "name": "model_id", + "in": "path", + "description": "The id of the model.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "The id of the model." + }, + "required": true + } + ], + "responses": { + "200": { + "description": "KNNGetModel 200 response" + } + }, + "x-operation-group": "knn.get_model", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/models/{model_id}/_train": { + "post": { + "description": "Create and train a model that can be used for initializing k-NN native library indexes during indexing.", + "operationId": "KNNTrainModel_WithModelId", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KNNTrainModel_BodyParams" + } + } + }, + "required": true + }, + "parameters": [ + { + "name": "model_id", + "in": "path", + "description": "The id of the model.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "The id of the model." + }, + "required": true + }, + { + "name": "preference", + "in": "query", + "description": "Preferred node to execute training.", + "schema": { + "type": "string", + "description": "Preferred node to execute training." + } + } + ], + "responses": { + "200": { + "description": "KNNTrainModel_WithModelId 200 response" + } + }, + "x-operation-group": "knn.train_model", + "x-version-added": "1.0" + } + }, "/_plugins/_security/api/account": { "get": { "description": "Returns account details for the current user.", @@ -32008,6 +33058,44 @@ "type": "object", "description": "The simulate definition" }, + "KNNSearchModels_BodyParams": { + "type": "object" + }, + "KNNTrainModel_BodyParams": { + "type": "object", + "properties": { + "training_index": { + "type": "string" + }, + "training_field": { + "type": "string" + }, + "dimension": { + "type": "integer", + "format": "int32" + }, + "max_training_vector_count": { + "type": "integer", + "format": "int32" + }, + "search_size": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string" + }, + "method": { + "type": "string" + } + }, + "required": [ + "dimension", + "method", + "training_field", + "training_index" + ] + }, "Mget_BodyParams": { "type": "object", "description": "Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL." From 3b867a3d189a0c023b8510dd5f2c41c567970b43 Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:20:43 -0800 Subject: [PATCH 25/30] Added spec for k-NN stats api (#190) * Added spec for k-NN stats api Signed-off-by: saimedhi * Added spec for k-NN stats api Signed-off-by: saimedhi --------- Signed-off-by: saimedhi Signed-off-by: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> --- model/common_strings.smithy | 6 ++++ model/knn/stats/operations.smithy | 56 +++++++++++++++++++++++++++++++ model/knn/stats/structures.smithy | 46 +++++++++++++++++++++++++ model/opensearch.smithy | 4 +++ 4 files changed, 112 insertions(+) create mode 100644 model/knn/stats/operations.smithy create mode 100644 model/knn/stats/structures.smithy diff --git a/model/common_strings.smithy b/model/common_strings.smithy index a2021587e..4850744a5 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -247,6 +247,12 @@ string PathTaskId @documentation("The name of the template.") string PathTemplateName +@xDataType("array") +@xEnumOptions(["circuit_breaker_triggered", "total_load_time", "eviction_count", "hit_count", "miss_count", "graph_memory_usage", "graph_memory_usage_percentage", "graph_index_requests", "graph_index_errors", "graph_query_requests", "graph_query_errors", "knn_query_requests", "cache_capacity_reached", "load_success_count", "load_exception_count", "indices_in_cache", "script_compilations", "script_compilation_errors", "script_query_requests", "script_query_errors", "nmslib_initialized", "faiss_initialized", "model_index_status", "indexing_from_model_degraded", "training_requests", "training_errors", "training_memory_usage", "training_memory_usage_percentage"]) +@pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") +@documentation("Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.") +string PathStats + @pattern("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$") @documentation("The id of the model.") string PathModelId diff --git a/model/knn/stats/operations.smithy b/model/knn/stats/operations.smithy new file mode 100644 index 000000000..6186c9410 --- /dev/null +++ b/model/knn/stats/operations.smithy @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#stats" +) + +@xOperationGroup("knn.stats") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/stats") +@documentation("Provides information about the current status of the k-NN plugin.") +operation KNNStats { + input: KNNStats_Input, + output: KNNStats_Output +} + +@xOperationGroup("knn.stats") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/{nodeId}/stats") +@documentation("Provides information about the current status of the k-NN plugin.") +operation KNNStats_WithNodeId { + input: KNNStats_WithNodeId_Input, + output: KNNStats_Output +} + +@xOperationGroup("knn.stats") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/stats/{stat}") +@documentation("Provides information about the current status of the k-NN plugin.") +operation KNNStats_WithStat { + input: KNNStats_WithStat_Input, + output: KNNStats_Output +} + +@xOperationGroup("knn.stats") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/{nodeId}/stats/{stat}") +@documentation("Provides information about the current status of the k-NN plugin.") +operation KNNStats_WithStatNodeId { + input: KNNStats_WithStatNodeId_Input, + output: KNNStats_Output +} diff --git a/model/knn/stats/structures.smithy b/model/knn/stats/structures.smithy new file mode 100644 index 000000000..c48fb14fb --- /dev/null +++ b/model/knn/stats/structures.smithy @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@mixin +structure KNNStats_QueryParams { + @httpQuery("timeout") + timeout: Timeout, +} + +@input +structure KNNStats_Input with [KNNStats_QueryParams] { +} + +@input +structure KNNStats_WithNodeId_Input with [KNNStats_QueryParams] { + @required + @httpLabel + nodeId: PathNodeId, +} + +@input +structure KNNStats_WithStat_Input with [KNNStats_QueryParams] { + @required + @httpLabel + stat: PathStats, +} + +@input +structure KNNStats_WithStatNodeId_Input with [KNNStats_QueryParams] { + @required + @httpLabel + nodeId: PathNodeId, + + @required + @httpLabel + stat: PathStats, +} + +// TODO: Fill in Output Structure +structure KNNStats_Output{} diff --git a/model/opensearch.smithy b/model/opensearch.smithy index e8a1b55bc..f58908c26 100644 --- a/model/opensearch.smithy +++ b/model/opensearch.smithy @@ -260,6 +260,10 @@ service OpenSearch { KNNGetModel, KNNSearchModels_Get, KNNSearchModels_Post, + KNNStats, + KNNStats_WithNodeId, + KNNStats_WithStat, + KNNStats_WithStatNodeId, KNNTrainModel, KNNTrainModel_WithModelId, Mget_Get, From 6bd8f3b1cd687e58fd4654c3e8d299b2b1787bae Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:21:13 -0800 Subject: [PATCH 26/30] Added spec for k-NN warmup api (#191) Signed-off-by: saimedhi Signed-off-by: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> --- model/knn/warmup/operations.smithy | 23 +++++++++++++++++++++++ model/knn/warmup/structures.smithy | 18 ++++++++++++++++++ model/opensearch.smithy | 1 + 3 files changed, 42 insertions(+) create mode 100644 model/knn/warmup/operations.smithy create mode 100644 model/knn/warmup/structures.smithy diff --git a/model/knn/warmup/operations.smithy b/model/knn/warmup/operations.smithy new file mode 100644 index 000000000..485c56bf0 --- /dev/null +++ b/model/knn/warmup/operations.smithy @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/search-plugins/knn/api/#warmup-operation" +) + +@xOperationGroup("knn.warmup") +@xVersionAdded("1.0") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_knn/warmup/{index}") +@documentation("Preloads native library files into memory, reducing initial search latency for specified indexes") +operation KNNWarmup { + input: KNNWarmup_Input, + output: KNNWarmup_Output +} diff --git a/model/knn/warmup/structures.smithy b/model/knn/warmup/structures.smithy new file mode 100644 index 000000000..febefdbc8 --- /dev/null +++ b/model/knn/warmup/structures.smithy @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@input +structure KNNWarmup_Input { + @required + @httpLabel + index: PathIndices, +} + +// TODO: Fill in Output Structure +structure KNNWarmup_Output{} diff --git a/model/opensearch.smithy b/model/opensearch.smithy index f58908c26..92aa87f90 100644 --- a/model/opensearch.smithy +++ b/model/opensearch.smithy @@ -266,6 +266,7 @@ service OpenSearch { KNNStats_WithStatNodeId, KNNTrainModel, KNNTrainModel_WithModelId, + KNNWarmup, Mget_Get, Mget_Get_WithIndex, Mget_Post, From a45b5511f633f17a32361e00607aeade9a962982 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:44:46 -0500 Subject: [PATCH 27/30] Update OpenAPI specs (#198) Signed-off-by: GitHub Co-authored-by: Xtansia --- OpenSearch.openapi.json | 247 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index b81b9276f..fc0588afa 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -13060,6 +13060,253 @@ "x-version-added": "1.0" } }, + "/_plugins/_knn/stats": { + "get": { + "description": "Provides information about the current status of the k-NN plugin.", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#stats" + }, + "operationId": "KNNStats", + "parameters": [ + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + } + ], + "responses": { + "200": { + "description": "KNNStats 200 response" + } + }, + "x-operation-group": "knn.stats", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/stats/{stat}": { + "get": { + "description": "Provides information about the current status of the k-NN plugin.", + "operationId": "KNNStats_WithStat", + "parameters": [ + { + "name": "stat", + "in": "path", + "description": "Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.", + "x-enum-options": [ + "circuit_breaker_triggered", + "total_load_time", + "eviction_count", + "hit_count", + "miss_count", + "graph_memory_usage", + "graph_memory_usage_percentage", + "graph_index_requests", + "graph_index_errors", + "graph_query_requests", + "graph_query_errors", + "knn_query_requests", + "cache_capacity_reached", + "load_success_count", + "load_exception_count", + "indices_in_cache", + "script_compilations", + "script_compilation_errors", + "script_query_requests", + "script_query_errors", + "nmslib_initialized", + "faiss_initialized", + "model_index_status", + "indexing_from_model_degraded", + "training_requests", + "training_errors", + "training_memory_usage", + "training_memory_usage_percentage" + ], + "x-data-type": "array" + }, + "required": true + }, + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + } + ], + "responses": { + "200": { + "description": "KNNStats_WithStat 200 response" + } + }, + "x-operation-group": "knn.stats", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/warmup/{index}": { + "get": { + "description": "Preloads native library files into memory, reducing initial search latency for specified indexes", + "externalDocs": { + "description": "API Reference", + "url": "https://opensearch.org/docs/latest/search-plugins/knn/api/#warmup-operation" + }, + "operationId": "KNNWarmup", + "parameters": [ + { + "name": "index", + "in": "path", + "description": "Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "Comma-separated list of indices; use `_all` or empty string to perform the operation on all indices.", + "x-data-type": "array" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "KNNWarmup 200 response" + } + }, + "x-operation-group": "knn.warmup", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/{nodeId}/stats": { + "get": { + "description": "Provides information about the current status of the k-NN plugin.", + "operationId": "KNNStats_WithNodeId", + "parameters": [ + { + "name": "nodeId", + "in": "path", + "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", + "x-data-type": "array" + }, + "required": true + }, + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + } + ], + "responses": { + "200": { + "description": "KNNStats_WithNodeId 200 response" + } + }, + "x-operation-group": "knn.stats", + "x-version-added": "1.0" + } + }, + "/_plugins/_knn/{nodeId}/stats/{stat}": { + "get": { + "description": "Provides information about the current status of the k-NN plugin.", + "operationId": "KNNStats_WithStatNodeId", + "parameters": [ + { + "name": "nodeId", + "in": "path", + "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", + "x-data-type": "array" + }, + "required": true + }, + { + "name": "stat", + "in": "path", + "description": "Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.", + "schema": { + "type": "string", + "pattern": "^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$", + "description": "Comma-separated list of stats to retrieve; use `_all` or empty string to retrieve all stats.", + "x-enum-options": [ + "circuit_breaker_triggered", + "total_load_time", + "eviction_count", + "hit_count", + "miss_count", + "graph_memory_usage", + "graph_memory_usage_percentage", + "graph_index_requests", + "graph_index_errors", + "graph_query_requests", + "graph_query_errors", + "knn_query_requests", + "cache_capacity_reached", + "load_success_count", + "load_exception_count", + "indices_in_cache", + "script_compilations", + "script_compilation_errors", + "script_query_requests", + "script_query_errors", + "nmslib_initialized", + "faiss_initialized", + "model_index_status", + "indexing_from_model_degraded", + "training_requests", + "training_errors", + "training_memory_usage", + "training_memory_usage_percentage" + ], + "x-data-type": "array" + }, + "required": true + }, + { + "name": "timeout", + "in": "query", + "description": "Operation timeout.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout.", + "x-data-type": "time" + } + } + ], + "responses": { + "200": { + "description": "KNNStats_WithStatNodeId 200 response" + } + }, + "x-operation-group": "knn.stats", + "x-version-added": "1.0" + } + }, "/_plugins/_security/api/account": { "get": { "description": "Returns account details for the current user.", From 23fa274e6b8609db587623d6f1f05346b023bd11 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Tue, 12 Mar 2024 15:56:05 -0400 Subject: [PATCH 28/30] Add a comment on coverage to PRs. (#196) Signed-off-by: dblock --- .github/workflows/coverage.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 922176c9e..532e5120f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,6 +1,6 @@ name: API Coverage -on: [push, pull_request] +on: [push, pull_request_target] env: JAVA_VERSION: 11 @@ -8,12 +8,14 @@ env: jobs: coverage: - runs-on: ubuntu-latest permissions: pull-requests: write + runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Build and Run Docker Container run: | docker build coverage --tag opensearch-with-api-plugin @@ -40,3 +42,14 @@ jobs: total=`jq -r '.paths | keys | length' OpenSearch.auto.openapi.json` percent=$((current * 100 / total)) echo "API specs implemented for $current/$total ($percent%) APIs." + cat >>"$GITHUB_OUTPUT" < Date: Thu, 21 Mar 2024 06:24:18 -0700 Subject: [PATCH 29/30] Added include_named_queries_score param in Search API and primary_only in Forcemerge API (#203) Signed-off-by: saimedhi --- model/_global/search/structures.smithy | 6 +++++- model/common_booleans.smithy | 6 ++++++ model/indices/forcemerge/structures.smithy | 4 ++++ model/knn/stats/operations.smithy | 4 ++-- model/knn/stats/structures.smithy | 4 ++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/model/_global/search/structures.smithy b/model/_global/search/structures.smithy index 97a47e82a..510099646 100644 --- a/model/_global/search/structures.smithy +++ b/model/_global/search/structures.smithy @@ -151,7 +151,11 @@ structure Search_QueryParams { rest_total_hits_as_int: RestTotalHitsAsInt, @httpQuery("search_pipeline") - search_pipeline: SearchPipeline + search_pipeline: SearchPipeline, + + @httpQuery("include_named_queries_score") + @default(false) + include_named_queries_score: IncludeNamedQueriesScore } @documentation("The search definition using the Query DSL") diff --git a/model/common_booleans.smithy b/model/common_booleans.smithy index e3dc25fde..8221b08c1 100644 --- a/model/common_booleans.smithy +++ b/model/common_booleans.smithy @@ -89,6 +89,9 @@ boolean IncludeDefaults @documentation("Return information about disk usage and shard sizes.") boolean IncludeDiskInfo +@documentation("Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)") +boolean IncludeNamedQueriesScore + @documentation("Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).") boolean IncludeSegmentFileSizes @@ -131,6 +134,9 @@ boolean PreserveExisting @documentation("Set to true to return stats only for primary shards.") boolean Pri +@documentation("Specify whether the operation should only perform on primary shards. Defaults to false.") +boolean PrimaryOnly + @documentation("Specify whether to profile the query execution.") boolean Profile diff --git a/model/indices/forcemerge/structures.smithy b/model/indices/forcemerge/structures.smithy index 655da3d9e..81b47f468 100644 --- a/model/indices/forcemerge/structures.smithy +++ b/model/indices/forcemerge/structures.smithy @@ -13,6 +13,10 @@ structure IndicesForcemerge_QueryParams { @default(true) flush: Flush, + @httpQuery("primary_only") + @default(false) + primary_only: PrimaryOnly, + @httpQuery("ignore_unavailable") ignore_unavailable: IgnoreUnavailable, diff --git a/model/knn/stats/operations.smithy b/model/knn/stats/operations.smithy index 6186c9410..dd4a3b985 100644 --- a/model/knn/stats/operations.smithy +++ b/model/knn/stats/operations.smithy @@ -26,7 +26,7 @@ operation KNNStats { @xVersionAdded("1.0") @readonly @suppress(["HttpUriConflict"]) -@http(method: "GET", uri: "/_plugins/_knn/{nodeId}/stats") +@http(method: "GET", uri: "/_plugins/_knn/{node_id}/stats") @documentation("Provides information about the current status of the k-NN plugin.") operation KNNStats_WithNodeId { input: KNNStats_WithNodeId_Input, @@ -48,7 +48,7 @@ operation KNNStats_WithStat { @xVersionAdded("1.0") @readonly @suppress(["HttpUriConflict"]) -@http(method: "GET", uri: "/_plugins/_knn/{nodeId}/stats/{stat}") +@http(method: "GET", uri: "/_plugins/_knn/{node_id}/stats/{stat}") @documentation("Provides information about the current status of the k-NN plugin.") operation KNNStats_WithStatNodeId { input: KNNStats_WithStatNodeId_Input, diff --git a/model/knn/stats/structures.smithy b/model/knn/stats/structures.smithy index c48fb14fb..340e9f10c 100644 --- a/model/knn/stats/structures.smithy +++ b/model/knn/stats/structures.smithy @@ -21,7 +21,7 @@ structure KNNStats_Input with [KNNStats_QueryParams] { structure KNNStats_WithNodeId_Input with [KNNStats_QueryParams] { @required @httpLabel - nodeId: PathNodeId, + node_id: PathNodeId, } @input @@ -35,7 +35,7 @@ structure KNNStats_WithStat_Input with [KNNStats_QueryParams] { structure KNNStats_WithStatNodeId_Input with [KNNStats_QueryParams] { @required @httpLabel - nodeId: PathNodeId, + node_id: PathNodeId, @required @httpLabel From 3763fdd051889c26e4f865734501c483d429de9f Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:43:37 -0400 Subject: [PATCH 30/30] Update OpenAPI specs (#204) Signed-off-by: GitHub Co-authored-by: dblock --- OpenSearch.openapi.json | 68 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/OpenSearch.openapi.json b/OpenSearch.openapi.json index fc0588afa..aa4420c5a 100644 --- a/OpenSearch.openapi.json +++ b/OpenSearch.openapi.json @@ -8228,6 +8228,16 @@ "description": "Specify whether the index should be flushed after performing the operation." } }, + { + "name": "primary_only", + "in": "query", + "description": "Specify whether the operation should only perform on primary shards. Defaults to false.", + "schema": { + "type": "boolean", + "default": false, + "description": "Specify whether the operation should only perform on primary shards. Defaults to false." + } + }, { "name": "ignore_unavailable", "in": "query", @@ -13189,13 +13199,13 @@ "x-version-added": "1.0" } }, - "/_plugins/_knn/{nodeId}/stats": { + "/_plugins/_knn/{node_id}/stats": { "get": { "description": "Provides information about the current status of the k-NN plugin.", "operationId": "KNNStats_WithNodeId", "parameters": [ { - "name": "nodeId", + "name": "node_id", "in": "path", "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", "schema": { @@ -13227,13 +13237,13 @@ "x-version-added": "1.0" } }, - "/_plugins/_knn/{nodeId}/stats/{stat}": { + "/_plugins/_knn/{node_id}/stats/{stat}": { "get": { "description": "Provides information about the current status of the k-NN plugin.", "operationId": "KNNStats_WithStatNodeId", "parameters": [ { - "name": "nodeId", + "name": "node_id", "in": "path", "description": "Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes.", "schema": { @@ -16433,6 +16443,16 @@ "type": "string", "description": "Customizable sequence of processing stages applied to search queries." } + }, + { + "name": "include_named_queries_score", + "in": "query", + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)" + } } ], "responses": { @@ -16926,6 +16946,16 @@ "type": "string", "description": "Customizable sequence of processing stages applied to search queries." } + }, + { + "name": "include_named_queries_score", + "in": "query", + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)" + } } ], "responses": { @@ -25493,6 +25523,16 @@ "description": "Specify whether the index should be flushed after performing the operation." } }, + { + "name": "primary_only", + "in": "query", + "description": "Specify whether the operation should only perform on primary shards. Defaults to false.", + "schema": { + "type": "boolean", + "default": false, + "description": "Specify whether the operation should only perform on primary shards. Defaults to false." + } + }, { "name": "ignore_unavailable", "in": "query", @@ -27741,6 +27781,16 @@ "type": "string", "description": "Customizable sequence of processing stages applied to search queries." } + }, + { + "name": "include_named_queries_score", + "in": "query", + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)" + } } ], "responses": { @@ -28253,6 +28303,16 @@ "type": "string", "description": "Customizable sequence of processing stages applied to search queries." } + }, + { + "name": "include_named_queries_score", + "in": "query", + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)", + "schema": { + "type": "boolean", + "default": false, + "description": "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)" + } } ], "responses": {