opensearch-project / reporting

Export and automate PNG, PDF, and CSV reports in OpenSearch Dashboards
https://opensearch.org/docs/latest/dashboards/reporting/
Apache License 2.0
28 stars 64 forks source link

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

Open dd00f opened 4 months ago

dd00f commented 4 months ago

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:

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?

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}