//language=JSON5
String str = "{\n" +
" \"match_all\": {}\n" +
"}";
WrapperQueryBuilder wrapperQueryBuilder = QueryBuilders.wrapperQuery(str);
// 执行搜索 使用elasticsearchTemplate.getClient()获取client
SearchResponse searchResponse = elasticsearchTemplate.getClient().prepareSearch(StudentTaskStatusDocument.INDEX_NAME)
.setTypes(StudentTaskStatusDocument.TYPE).setQuery(wrapperQueryBuilder).setSize(20).get();
SearchHit[] hits = searchResponse.getHits().getHits();
System.out.println("");
其他参考资料: