Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Java client unable to get the HTTP response code from a ResponseException #973

Open
dd00f opened this issue Mar 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dd00f
Copy link

dd00f commented Mar 7, 2024

What is the bug?
Our OpenSearch HTTP Client needs to see the HTTP Response code from OpenSearch to handle various failure scenarios. However, the class : org.opensearch.client.transport.httpclient5.Response is package private, preventing clients from accessing all the details it stores

How can one reproduce the bug?
Steps to reproduce the behavior:

  • Make a call to openSearch using org.opensearch.client:opensearch-java:2.8.0 client
  • Simulate an internal server error on Open Search that returns a HTTP 500 error code.
  • Try to access the error code from the HTTP response, notice how no fields are accessible in the class

What is the expected behavior?
Make org.opensearch.client.transport.httpclient5.Response public so that clients may read details about the error response.

What is your host/environment?

  • OS: any
  • Version : any
  • Plugins : Not applicable

Do you have any screenshots?
Not applicable

Do you have any additional context?
Here is the sample response we received from one of our systems :

Caused by: org.opensearch.client.transport.httpclient5.ResponseException: method [POST], host [https://localhost:9200], URI [/my-query-alias/_search?typed_keys=true&request_cache=false], status line [HTTP/1.1 500 Internal Server Error]
{"error":{"root_cause":[{"type":"security_exception","reason":"Unexpected exception indices:data/read/search"}],"type":"security_exception","reason":"Unexpected exception indices:data/read/search"},"status":500}

@dd00f dd00f added bug Something isn't working untriaged labels Mar 7, 2024
@Swiddis Swiddis removed the untriaged label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants