ScriptSortBuilder按照自定义脚本进行排序(例子中是随机排序)Script script = new Script("Math.random()"); ScriptSortBuilder scriptSortBuilder = SortBuilders.scriptSort(script,ScriptSortBuilder.ScriptSortType.NUMBER).order(SortOrder.DESC); SearchRequest searchRequest = new SearchRequest(new String[]{"inde...