身安不如心安,屋宽不如心宽 。

spring-data-elasticsearch 查询部分指定字段

Elasticsearch | 作者 CatCoder | 发布于2018年10月25日 | 阅读数:5559

我通过spring-data-elasticsearch(6.x)将一条字段很多的数据存入,现在只想取出部分指定字段,请教各位大佬怎么实现
已邀请:

rochy - rochy_he

赞同来自:

在查询语句里面限制查询的字段
String[] includeFields = new String[] {"title", "user", "innerObject.*"};
String[] excludeFields = new String[] {"_type"};
sourceBuilder.fetchSource(includeFields, excludeFields);

CatCoder - 偷代码的代码猫

赞同来自:

谢谢了

要回复问题请先登录注册