95.8. MultiSearch 示例
MultiSearching on specific field (s)和 value 使用 Operation 'MultiSearch'。传递 MultiSearchRequest 实例
from("direct:multiSearch") .to("elasticsearch-rest://elasticsearch?operation=MultiSearch");
<route> <from uri="direct:multiSearch" /> <to uri="elasticsearch-rest://elasticsearch?operation=MultiSearch"/> </route>
MultiSearch on specific field (s)
SearchRequest req = new SearchRequest(); req.indices("twitter"); req.types("tweet"); SearchRequest req1 = new SearchRequest(); req.indices("twitter"); req.types("tweets"); MultiSearchRequest request = new MultiSearchRequest().add(req1).add(req); Item[] response = template.requestBody("direct:search", request, Item[].class);