95.8. MultiSearch 示例
多搜索特定字段和值使用 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 fields)
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);