From 60a7ee43719e9c0151a06df78b271818afe6c422 Mon Sep 17 00:00:00 2001 From: Devon Terrell Date: Wed, 10 Jul 2024 09:15:28 -0700 Subject: [PATCH] Add search pipeline support to search api Adds support for specifying a [search pipeline](https://opensearch.org/docs/latest/search-plugins/search-pipelines/using-search-pipeline/) as part of a `SearchRequest`. The field, if set, is added as a query parameter during the construction of the request URL, and otherwise has no impact. --- opensearchapi/api.search.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opensearchapi/api.search.go b/opensearchapi/api.search.go index d0451d818..8efa191c0 100644 --- a/opensearchapi/api.search.go +++ b/opensearchapi/api.search.go @@ -84,6 +84,7 @@ type SearchRequest struct { RestTotalHitsAsInt *bool Routing []string Scroll time.Duration + SearchPipeline string SearchType string SeqNoPrimaryTerm *bool Size *int @@ -231,6 +232,10 @@ func (r SearchRequest) Do(ctx context.Context, transport Transport) (*Response, params["scroll"] = formatDuration(r.Scroll) } + if r.SearchPipeline != "" { + params["search_pipeline"] = r.SearchPipeline + } + if r.SearchType != "" { params["search_type"] = r.SearchType }