From 2b0451e2c19ce04d987d8fc3a88deffe0de5aa75 Mon Sep 17 00:00:00 2001 From: saimedhi Date: Thu, 22 Feb 2024 12:22:44 -0800 Subject: [PATCH] Added spec for k-NN warmup api Signed-off-by: saimedhi --- model/common_strings.smithy | 3 +++ model/knn/warmup/operations.smithy | 23 +++++++++++++++++++++++ model/knn/warmup/structures.smithy | 18 ++++++++++++++++++ model/opensearch.smithy | 1 + 4 files changed, 45 insertions(+) create mode 100644 model/knn/warmup/operations.smithy create mode 100644 model/knn/warmup/structures.smithy diff --git a/model/common_strings.smithy b/model/common_strings.smithy index b6a2c928c..c36fb006c 100644 --- a/model/common_strings.smithy +++ b/model/common_strings.smithy @@ -318,6 +318,9 @@ string WaitForActiveShards @documentation("Wait until the specified number of nodes is available.") string WaitForNodes +@documentation("Comma-separated list of indices; use `_all` to perform the operation on all indices.") +string KnnIndices + @xDataType("time") @pattern("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$") @documentation("Time each individual bulk request should wait for shards that are unavailable.") 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..2573ac7b1 --- /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: KnnIndices, +} + +// TODO: Fill in Output Structure +structure KNNWarmup_Output{} diff --git a/model/opensearch.smithy b/model/opensearch.smithy index ccb6b3805..b48ee6159 100644 --- a/model/opensearch.smithy +++ b/model/opensearch.smithy @@ -256,6 +256,7 @@ service OpenSearch { IngestSimulate_Get_WithId, IngestSimulate_Post, IngestSimulate_Post_WithId, + KNNWarmup, Mget_Get, Mget_Get_WithIndex, Mget_Post,