Open
Description
Java API client version
8.8
Java version
11
Elasticsearch Version
8.8
Problem description
Your example for searchTemplate in documentation and code was confusing as multiple people who were assisting me all assumed Field and Value should be the fields and values that we were replacing.
SearchTemplateResponse<Product> response = esClient.searchTemplate(r -> r
.index("some-index")
.id("query-script") // <1>
.params("field", JsonData.of("some-field")) // <2>
.params("value", JsonData.of("some-data")),
Product.class
);
So if we had 3 parameters, a,b,c we kept attempting
.params("field", JsonData.of("a"))
.params("value", JsonData.of("some-data-for-a"))
.params("field", JsonData.of("b"))
.params("value", JsonData.of("some-data-for-b"))
.params("field", JsonData.of("c"))
.params("value", JsonData.of("some-data-for-c"))
As often field:value arrays are done in such way.
Is there a way you can make the example more clear?