Skip to content

Commit

Permalink
Add failing msearchTemplate integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Oct 11, 2023
1 parent dc41a99 commit 4e96484
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SimpleDoc> sendTemplateRequest(String index, String title, boolean suggs, boolean aggs)
throws IOException {
return javaClient().searchTemplate(
Expand Down

0 comments on commit 4e96484

Please sign in to comment.