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 _routing field in SearchHit interface #516

Closed tushar2404 closed 2 months ago

tushar2404 commented 3 months ago

Description

Added Routing field in SearchHit interface

premise:

The OpenSearch Search API currently does not return the routing key in its responses. The routing key is a crucial piece of information, especially in cases where the user or the application has specified a custom routing key for a document at the time of its creation. This omission means that any application or user querying documents from OpenSearch will not receive this key as part of the search results.

Issues Resolved

This pull request addresses this gap by adding a Routing field to the SearchHit interface. With this change, the API will now include the routing key in the search results.

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 3 months 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 (445f046). Report is 16 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #516 +/- ## =========================================== + Coverage 57.29% 67.96% +10.66% =========================================== Files 315 376 +61 Lines 9823 8852 -971 =========================================== + Hits 5628 6016 +388 + Misses 2902 1555 -1347 + Partials 1293 1281 -12 ``` | [Flag](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/516/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/516/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `60.38% <ø> (+9.54%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/516/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `15.26% <ø> (+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/516?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/516?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 [268 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/516/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
Jakob3xD commented 2 months ago

Thanks for the PR. Please add a test for this field.

tushar2404 commented 2 months ago

Thanks for the PR. Please add a test for this field.

done