Skip to content

Commit

Permalink
Added spec for k-NN stats api
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi committed Feb 22, 2024
1 parent 1787056 commit 0edee36
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
6 changes: 6 additions & 0 deletions model/common_strings.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -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

@documentation("The analyzer to use for the query string.")
string Analyzer

Expand Down
56 changes: 56 additions & 0 deletions model/knn/stats/operations.smithy
Original file line number Diff line number Diff line change
@@ -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
}
46 changes: 46 additions & 0 deletions model/knn/stats/structures.smithy
Original file line number Diff line number Diff line change
@@ -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: PathStat,
}

@input
structure KNNStats_WithStatNodeId_Input with [KNNStats_QueryParams] {
@required
@httpLabel
nodeId: PathNodeId,

@required
@httpLabel
stat: PathStats,
}

// TODO: Fill in Output Structure
structure KNNStats_Output{}
4 changes: 4 additions & 0 deletions model/opensearch.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ service OpenSearch {
IngestSimulate_Get_WithId,
IngestSimulate_Post,
IngestSimulate_Post_WithId,
KNNStats,
KNNStats_WithNodeId,
KNNStats_WithStat,
KNNStats_WithStatNodeId,
Mget_Get,
Mget_Get_WithIndex,
Mget_Post,
Expand Down

0 comments on commit 0edee36

Please sign in to comment.