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

Search pipelines added #172

Merged
merged 9 commits into from
Mar 24, 2024
2 changes: 2 additions & 0 deletions model/opensearch.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ service OpenSearch {
CreateUser,
Create_Post,
Create_Put,
CreateSearchPipeline,
DanglingIndicesDeleteDanglingIndex,
DanglingIndicesImportDanglingIndex,
DanglingIndicesListDanglingIndices,
Expand Down Expand Up @@ -143,6 +144,7 @@ service OpenSearch {
GetRoles,
GetRoleMapping,
GetRoleMappings,
GetSearchPipeline,
GetTenant,
GetTenants,
GetUser,
Expand Down
23 changes: 23 additions & 0 deletions model/search_pipeline/create_search_pipeline/operations.smithy
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/search-pipelines/creating-search-pipeline/"
)

@xOperationGroup("search_pipeline.create_search_pipeline")
nhtruong marked this conversation as resolved.
Show resolved Hide resolved
@xVersionAdded("2.9")
@idempotent
@suppress(["HttpUriConflict"])
@http(method: "PUT", uri: "/_search/pipeline/{pipeline}")
@documentation("Creates or replaces the specified search pipeline.")
operation CreateSearchPipeline {
input: CreateSearchPipeline_Input,
output: CreateSearchPipeline_Output
}
24 changes: 24 additions & 0 deletions model/search_pipeline/create_search_pipeline/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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 CreateSearchPipeline_Input{
@required
@httpLabel
pipeline: String
@required
@httpPayload
content: SearchPipeline
}

@output
structure CreateSearchPipeline_Output {
acknowledged: Boolean
}
23 changes: 23 additions & 0 deletions model/search_pipeline/get_search_pipeline/operations.smithy
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/search-pipelines/index/"
)

@xOperationGroup("search_pipeline.get_search_pipeline")
nhtruong marked this conversation as resolved.
Show resolved Hide resolved
@xVersionAdded("2.9")
@readonly
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_search/pipeline/{pipeline}")
@documentation("Retrieves information about a specified search pipeline.")
operation GetSearchPipeline {
input: GetSearchPipeline_Input,
output: GetSearchPipeline_Output
}
20 changes: 20 additions & 0 deletions model/search_pipeline/get_search_pipeline/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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 GetSearchPipeline_Input {
@required
@httpLabel
pipeline: String,
}

structure GetSearchPipeline_Output {
@httpPayload
content: SearchPipeline
}
80 changes: 80 additions & 0 deletions model/search_pipeline/search_pipeline.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// 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 SearchPipeline{
version: Integer,
request_processors: RequestProcessorsList,
response_processors: ResponseProcessorsList
Copy link
Collaborator

Choose a reason for hiding this comment

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

}

list RequestProcessorsList {
member: RequestProcessors
}

list ResponseProcessorsList {
member: RequestProcessors
}


structure RequestProcessors {
filter_query: FilterQuery,
neural_query_enricher: NeuralQueryEnricher,
script: SearchScript
}

structure ResponseProcessors {
personalize_search_ranking: PersonalizeSearchRanking,
rename_field: RenameField,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really these are more like unions rather than structures, but not sure how the OpenAPI conversion handles unions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Union will become oneOf in OpenAPI

Copy link
Collaborator Author

@Tokesh Tokesh Feb 8, 2024

Choose a reason for hiding this comment

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

I never used unions. Do i need to implement it here?


structure FilterQuery {
query: UserDefinedObjectStructure,
tag: String,
description: String,
ignore_failure: Boolean
}

structure NeuralQueryEnricher {
default_model_id: String,
neural_field_default_id: NeuralFieldMap
tag: String,
description: String,
}

structure SearchScript {
source: String,
lang: String,
tag: String,
description: String,
ignore_failure: Boolean
}

structure PersonalizeSearchRanking {
campaign_arn: String,
recipe: String,
weight: Float,
item_id_field: String,
iam_role_arn: String,
tag: String,
description: String,
ignore_failure: Boolean
}

structure RenameField {
field: String,
target_field: String,
tag: String,
description: String,
ignore_failure: Boolean
}

map NeuralFieldMap {
key: String,
value: String
}
Loading