1. 程式人生 > >elasticsearch CriteriaQuery查詢例子

elasticsearch CriteriaQuery查詢例子

entity contain ogl pdo 127.0.0.1 eval Pageable last class

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);

elasticsearch CriteriaQuery查詢例子