You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling opensearchapi.Client.Search with a query with a highlight specified, the highlight results coming back in the raw json coming back from the OpenSearch cluster are not returned on the SearchHits in the SearchResp.
How can one reproduce the bug?
Call opensearchapi.Client.Search() with a SearchReq with a body with a highlight property specifying highlights for fields that match in they query.
What is the expected behavior?
The SearchResp coming back from Client.Search should include the highlight results in the SearchHits, as they are returned in the raw json api response from the OpenSearch cluster.
What is your host/environment?
using opensearch-go@v4.3.0 on mac os 14.7.2 and running in aws lambda.
querying Amazon OpenSearch Service 2.15 cluster.
Do you have any screenshots?
Do you have any additional context?
It seems like the highlight field is already coming back in the raw json, and just needs to be added to SearchHit so that it will be populated when the json response is unmarshalled, like this:
type SearchHit struct {
Index string `json:"_index"`
ID string `json:"_id"`
Routing string `json:"_routing"`
Score float32 `json:"_score"`
Source json.RawMessage `json:"_source"`
Fields json.RawMessage `json:"fields"`
Type string `json:"_type"` // Deprecated field
Sort []any `json:"sort"`
Explanation *DocumentExplainDetails `json:"_explanation"`
SeqNo *int `json:"_seq_no"`
PrimaryTerm *int `json:"_primary_term"`
+ Highlight map[string][]string `json:"highlight"`
}
I'm happy to investigate this further and PR it, if it's not already in the works to add this field to the response.
The text was updated successfully, but these errors were encountered:
Hi @dblock, what do you think about adding support for returning the highlight results on SearchHit like this? The linked draft PR should accomplish this, with integration test for it. I'm not sure what the failing tests are about -- seem unrelated and like they're failing in other recent PRs -- so I left the PR as draft until someone with more context can assess those.
It would be awesome if this missing field is something we could add to opensearch-go, so let me know what you think and if there's anything else I need to do on that PR to help move it along!
What is the bug?
When calling
opensearchapi.Client.Search
with a query with a highlight specified, the highlight results coming back in the raw json coming back from the OpenSearch cluster are not returned on theSearchHit
s in theSearchResp
.How can one reproduce the bug?
Call opensearchapi.Client.Search() with a
SearchReq
with a body with ahighlight
property specifying highlights for fields that match in they query.What is the expected behavior?
The SearchResp coming back from
Client.Search
should include the highlight results in the SearchHits, as they are returned in the raw json api response from the OpenSearch cluster.What is your host/environment?
using
opensearch-go@v4.3.0
on mac os 14.7.2 and running in aws lambda.querying Amazon OpenSearch Service 2.15 cluster.
Do you have any screenshots?
Do you have any additional context?
It seems like the
highlight
field is already coming back in the raw json, and just needs to be added to SearchHit so that it will be populated when the json response is unmarshalled, like this:I'm happy to investigate this further and PR it, if it's not already in the works to add this field to the response.
The text was updated successfully, but these errors were encountered: