21.9. MultiSearch 示例
MultiSearching on specific 字段和值使用 Operation 'MultiSearch'。传递 MultiSearchRequest 实例
from("direct:multiSearch") .to("elasticsearch://elasticsearch?operation=MultiSearch");
<route> <from uri="direct:multiSearch"/> <to uri="elasticsearch://elasticsearch?operation=MultiSearch"/> </route>
MultiSearch on specific field (s)
MsearchRequest.Builder builder = new MsearchRequest.Builder().index("twitter").searches( new RequestItem.Builder().header(new MultisearchHeader.Builder().build()) .body(new MultisearchBody.Builder().query(b -> b.matchAll(x -> x)).build()).build(), new RequestItem.Builder().header(new MultisearchHeader.Builder().build()) .body(new MultisearchBody.Builder().query(b -> b.matchAll(x -> x)).build()).build()); List<MultiSearchResponseItem<?>> response = template.requestBody("direct:multiSearch", builder, List.class);