If you create a Request with headers, then send the request via the RestClientTransport, those headers are ignored, and not included in the request that is actually sent to opensearch.
How can one reproduce the bug?
Create any request to any endpoint and specify a header
send that request via the OpensearchGenericClient's execute() function, with the transport configured to use the RestClientTransport.
You will find that the sent message does not include this header, making it impossible to do things like create index patterns programmatically using the dashboards API. The issue is in prepareLowLevelRequest(), which does not merge the headers from the incoming request object, only creating new ones. I'm not sure if the same behavior occurs with the other transport clients.
What is the expected behavior?
If I provide headers in my request, those headers should also appear in the request made to Opensearch and should not be lost.
What is your host/environment?
Mac OS 14.6 -- Running Opensearch 2.19.0 in Kubernetes, and using the latest version of the opensearch-java library (2.15.0)
What is the bug?
If you create a Request with headers, then send the request via the RestClientTransport, those headers are ignored, and not included in the request that is actually sent to opensearch.
How can one reproduce the bug?
Create any request to any endpoint and specify a header
send that request via the
OpensearchGenericClient
'sexecute()
function, with the transport configured to use theRestClientTransport
.You will find that the sent message does not include this header, making it impossible to do things like create index patterns programmatically using the dashboards API. The issue is in
prepareLowLevelRequest()
, which does not merge the headers from the incomingrequest
object, only creating new ones. I'm not sure if the same behavior occurs with the other transport clients.What is the expected behavior?
If I provide headers in my request, those headers should also appear in the request made to Opensearch and should not be lost.
What is your host/environment?
Mac OS 14.6 -- Running Opensearch 2.19.0 in Kubernetes, and using the latest version of the opensearch-java library (2.15.0)
Do you have any screenshots?
N/A
Do you have any additional context?
Add any other context about the problem.