From fe6f5b6339d8ce9af5a05cd3b8f10f329c89b0f9 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Wed, 6 Dec 2023 17:10:48 +0100 Subject: [PATCH] Propagate proxied request body to opensearch (#17603) --- .../graylog/storage/opensearch2/ProxyRequestAdapterOS2.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/ProxyRequestAdapterOS2.java b/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/ProxyRequestAdapterOS2.java index 9b06863df6dc..4d39c63ff978 100644 --- a/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/ProxyRequestAdapterOS2.java +++ b/graylog-storage-opensearch2/src/main/java/org/graylog/storage/opensearch2/ProxyRequestAdapterOS2.java @@ -16,6 +16,8 @@ */ package org.graylog.storage.opensearch2; +import org.graylog.shaded.opensearch2.org.apache.http.entity.ContentType; +import org.graylog.shaded.opensearch2.org.apache.http.entity.InputStreamEntity; import org.graylog.shaded.opensearch2.org.opensearch.OpenSearchException; import org.graylog.shaded.opensearch2.org.opensearch.client.Request; import org.graylog.shaded.opensearch2.org.opensearch.client.ResponseException; @@ -35,6 +37,8 @@ public ProxyRequestAdapterOS2(OpenSearchClient openSearchClient) { @Override public ProxyResponse request(ProxyRequest request) throws IOException { final var osRequest = new Request(request.method(), request.path()); + osRequest.setEntity(new InputStreamEntity(request.body(), ContentType.APPLICATION_JSON)); + try { final var osResponse = client.execute((c, requestOptions) -> { osRequest.setOptions(requestOptions);