ES实现模糊查询和排序

QueryBuilder titleQb = QueryBuilders.wildcardQuery(“article_title”, “" + keywords + "”);
QueryBuilder sumQb = QueryBuilders.wildcardQuery(“summary”, “" + keywords + "”);// multiMatchQuery
bqb.should(titleQb).should(sumQb);
resp = ESClient.client.prepareSearch(“testt”).setTypes(“user”).setQuery(bqb)

//参数灵活排序
sort = SortBuilders.fieldSort(sort_ + “.keyword”).order(SortOrder.fromString(order));
//固定排序
sort = SortBuilders.fieldSort(“updateTime.keyword”).order(SortOrder.DESC);

你可能感兴趣的:(ES)