-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Knn APIs get_model, search_model, delete_model, train_model
Signed-off-by: saimedhi <saimedhi@amazon.com>
- Loading branch information
Showing
10 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
@readonly | ||
@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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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_model") | ||
@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 KNNSearchModel_Get { | ||
input: KNNSearchModel_Get_Input, | ||
output: KNNSearchModel_Output | ||
} | ||
|
||
@xOperationGroup("knn.search_model") | ||
@xVersionAdded("1.0") | ||
@readonly | ||
@suppress(["HttpUriConflict"]) | ||
@http(method: "POST", uri: "/_plugins/_knn/models/_search") | ||
@documentation("Use an OpenSearch query to search for models in the index.") | ||
operation KNNSearchModel_Post { | ||
input: KNNSearchModel_Post_Input, | ||
output: KNNSearchModel_Output | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 KNNSearchModel_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 KNNSearchModel_BodyParams {} | ||
|
||
@input | ||
structure KNNSearchModel_Get_Input with [KNNSearchModel_QueryParams] {} | ||
|
||
@input | ||
structure KNNSearchModel_Post_Input with [KNNSearchModel_QueryParams] { | ||
@httpPayload | ||
content: KNNSearchModel_BodyParams, | ||
} | ||
|
||
// TODO: Fill in Output Structure | ||
structure KNNSearchModel_Output {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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") | ||
@readonly | ||
@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") | ||
@readonly | ||
@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 | ||
} |
Oops, something went wrong.