Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added spec for k-NN stats api #190

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
saimedhi marked this conversation as resolved.
Show resolved Hide resolved
@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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see pretty querystring param in the examples as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theo, pretty is a global parameter.

Those parameters can be used with all APIs. So, we won't write them in spec. Please confirm?

}

@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{}
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
Loading