From 4e964842612e76a0c52593e7e96ef04b879414d5 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 11 Oct 2023 15:22:41 +1300 Subject: [PATCH] Add failing msearchTemplate integration test Signed-off-by: Thomas Farr --- .../AbstractSearchTemplateRequestIT.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java index 9e029fe95f..daa960b9ce 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java @@ -85,6 +85,29 @@ public void testTemplateSearchAggregations() throws Exception { } + @Test + public void testMultiSearchTemplate() throws Exception { + var index = "test-msearch-template"; + createDocuments(index); + + var searchResponse = javaClient().msearchTemplate( + request -> request + .searchTemplates(r -> r + .header(h -> h.index(index)) + .body(t -> t + .id(TEST_SEARCH_TEMPLATE) + .params("title", JsonData.of("Document")) + .params("suggs", JsonData.of(false)) + .params("aggs", JsonData.of(false)))), + SimpleDoc.class + ); + + assertEquals(1, searchResponse.responses().size()); + var response = searchResponse.responses().get(0); + assertTrue(response.isResult()); + assertEquals(4, response.result().hits().hits().size()); + } + private SearchTemplateResponse sendTemplateRequest(String index, String title, boolean suggs, boolean aggs) throws IOException { return javaClient().searchTemplate(