elasticsearch CriteriaQuery查询例子

elasticsearch CriteriaQuery java API实例应用

CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria()
.and(new Criteria("clusterName").is("app"))
.and(new Criteria("ip").is("127.0.0.1"))
.and(new Criteria("appType").is("download"))
.and(new Criteria("appName").is("appdownload"))
.and(new Criteria("fileName").is("appdownload.log"))
.and(new Criteria("logLeval").is("info"))
.and(new Criteria("produceDateTime").greaterThanEqual(
startDate.getTime()).lessThanEqual(endDate.getTime()))
.and(new Criteria("message").contains("haha"))).setPageable(
new PageRequest(0, 10)).addSort(
new Sort(new Sort.Order(Sort.Direction.DESC, "segEndlineNo")));
Page<LogEntity> pages = elasticsearchTemplate.queryForPage(criteriaQuery,
LogEntity.class);

原文地址:https://www.cnblogs.com/snake23/p/9438785.html