opensearch-project / opensearch-project/opensearch-java
[FEATURE] Allow Response Objects and Exceptions to Access Http Response Headers
@georgereuben is already working on this.
Since Jul 8, 2025.
- Dominant language
- Java
- Stars
- 165
- Forks
- 250
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 26
Description
Is your feature request related to a problem?
A clear and concise description of what the problem is, e.g. I'm always frustrated when [...].
I am using the OpenSearchClient with the AwsSdk2Transport, and I cannot retrieve the http headers in the response. This makes it very hard for me to debug issues with my service provider as I cannot provide them request ids.
What solution would you like?
A clear and concise description of what you want to happen.
I would like for two changes:
- All response headers should be available on response objects exposed via a method such as
getResponseHeaders(). - All exceptions thrown because of a response error should also include the http headers from that response. I propose a class:
OpenSearchResponseExceptionto encapsulate this behavior.
What alternatives have you considered?
A clear and concise description of any alternative solutions or features you've considered.
I could not figure out a way to accomplish this by subclassing and overriding code in this package. I would need to migrate to a RestClient or ApacheHttpClient, implement Sigv4 signing, and do my own response parsing.
Do you have any additional context?
Add any other context or screenshots about the feature request here.
Here looks to be where the response is de-serialized and where headers are lost:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.