代码:
String time1 = ConstValue.GetCurrentDate();
SortBuilder sortBuilder = SortBuilders.fieldSort("tfp_save_time")
.order(SortOrder.DESC).ignoreUnmapped(true); SearchResponse scrollResp = client
.prepareSearch("flume-" + time1 + "-content-news")
.addHighlightedField("scc_content")
.addHighlightedField("scm_title")
.setQuery(ConstValue.queryBuilder22(requestSignal.getQuery()))
.addSort(sortBuilder).addHighlightedField("scc_title")
.setHighlighterPreTags("<em>").setHighlighterPostTags("</em>")
.setFrom((requestSignal.getPage() - 1) * 20).setSize(20)
.execute().actionGet();
官方粘的:
client.prepareSearch(indexName).setTypes(typeName)
.setQuery(query)
.addSort(fieldSort("activity").order(DESC).missing("_last"))
.setSize(limit)
.execute().actionGet();
The .missing("_last")
cannot be applied to boolean fields.