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 SeqNo and PrimaryTerm fields in SearchHit #574

Closed emtammaru closed 2 days ago

emtammaru commented 6 days ago

Description

Adds the missing fields SeqNo and PrimaryTerm to the SearchHit struct. These fields are optionally returned in the response as documented here with the seq_no_primary_term param: https://opensearch.org/docs/latest/api-reference/search/

Issues Resolved

N/A

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 6 days ago

Codecov Report

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

Project coverage is 67.96%. Comparing base (06a6dc8) to head (a907e9d). Report is 40 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #574 +/- ## =========================================== + Coverage 57.29% 67.96% +10.67% =========================================== Files 315 376 +61 Lines 9823 8853 -970 =========================================== + Hits 5628 6017 +389 + Misses 2902 1555 -1347 + Partials 1293 1281 -12 ``` | [Flag](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/574/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/574/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `60.41% <ø> (+9.57%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/574/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `15.28% <ø> (+2.43%)` | :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/574?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.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/574?src=pr&el=tree&filepath=opensearchapi%2Fapi_search.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-b3BlbnNlYXJjaGFwaS9hcGlfc2VhcmNoLmdv) | `100.00% <ø> (ø)` | | ... and [272 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/574/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 5 days ago

Thanks! This needs a rebase.

The proposal in #284 might be of interest. Also appreciate if you could take this opportunity to check https://github.com/opensearch-project/opensearch-api-specification for these fields and maybe add a test there.

emtammaru commented 5 days ago

Thanks! This needs a rebase.

The proposal in #284 might be of interest. Also appreciate if you could take this opportunity to check https://github.com/opensearch-project/opensearch-api-specification for these fields and maybe add a test there.

Thank you, I checked the spec and I see the fields under response for https://opensearch-project.github.io/opensearch-api-specification/#/default/search.0. Could you point me to where I could add a test for it in https://github.com/opensearch-project/opensearch-api-specification?

dblock commented 5 days ago

I think https://github.com/opensearch-project/opensearch-api-specification/blob/73d552477f8f006f5ff49f451494d150b8378b18/tests/_core/search.yaml would be a logical place. As long as these are mentioned somewhere.