ES基本操作参考:https://blog.csdn.net/jacksonary/article/details/82729556
实现复杂查询:
一、TransportClient实现
/**
* 根据name搜索
*
* @param name book name
*/
@RequestMapping(value = "/book_search", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> search(@RequestParam("name") String name) throws ExecutionException, InterruptedException {
//添加查询条件
//模糊查找
StringBuilder matchValue = new StringBuilder();
matchValue.append("*").append(name).append("*");
WildcardQueryBuilder matchQueryBuilder = QueryBuilders.wildcardQuery("name", String.valueOf(matchValue));
//范围查找
RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("id");//匹配id
rangeQuery.gt(0);//id > 0
//精确查找
//TermQueryBuilder ter