opensearch-project / opensearch-go

Go Client for OpenSearch
https://opensearch.org/docs/latest/clients/go/
Apache License 2.0
188 stars 96 forks source link

Add missing `search_pipeline` field in `opensearchapi.SearchParams` #532

Closed jackh-ncl closed 2 months ago

jackh-ncl commented 2 months ago

Description

Added search_pipeline field in SearchParams struct.

Note: I didn't add any tests as I can't see any others there for existing SearchParam fields.

Context:

With the addition of hybrid search and search pipelines in Opensearch version 2.11, a new search_pipeline parameter exists on the _search endpoint (docs here).

Issues Resolved

This pull request supports the new search pipelines functionality by allowing users of the library to set the search_pipeline parameter via the SearchParams struct.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.93%. Comparing base (06a6dc8) to head (cf059ca). Report is 15 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #532 +/- ## =========================================== + Coverage 57.29% 67.93% +10.64% =========================================== Files 315 376 +61 Lines 9823 8852 -971 =========================================== + Hits 5628 6014 +386 + Misses 2902 1556 -1346 + Partials 1293 1282 -11 ``` | [Flag](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `60.36% <0.00%> (+9.52%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `15.26% <100.00%> (+2.42%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [opensearchapi/api\_search-params.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532?src=pr&el=tree&filepath=opensearchapi%2Fapi_search-params.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-b3BlbnNlYXJjaGFwaS9hcGlfc2VhcmNoLXBhcmFtcy5nbw==) | `89.42% <100.00%> (+82.08%)` | :arrow_up: | ... and [270 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/532/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
dblock commented 2 months ago

We do need tests for existing and new code, can you please add something simple that exercises params, please?

jackh-ncl commented 2 months ago

@dblock I have pushed up some simple tests, though it's proving a bit difficult to get it right as the get() method is unexported, and golanglint wants test files to be under a test package (e.g. opensearchapi_test), which means I'm unable to access it.

I can either add make get() exported, add a nolint or it looks like I could follow this sort of structure, though I'm not too familiar with this approach.

Would appreciate any suggestions 😃

jackh-ncl commented 2 months ago

Thank you 😃