小编典典

只需要返回源字段,没有任何元数据-如何使用插件?

elasticsearch

我们要求我们仅返回搜索结果中的源字段,而不包含任何元数据。通过搜索,我发现使用Elasticsearch无法做到这一点,但是我确实找到了在该线程中使用插件的参考:

被链接的插件是这个:

https://github.com/imotov/elasticsearch-just-
source/blob/master/src/main/java/org/elasticsearch/examples/justsource/rest/action/RestJustSourceAction.java

我仍在学习Elasticsearch,但是有人可以解释我将如何在我们的Elasticsearch配置中实现和部署该插件吗?

谢谢,吉姆


阅读 261

收藏
2020-06-22

共1个答案

小编典典

如您所引用的第一个链接中所述,可以通过响应过滤来实现此功能,它不是插件,而是ES的标准功能:

GET /index/type/_search?filter_path=hits.hits._source

如果要摆脱,hits.hits._source可以使用jq

curl -XGET localhost:9200/index/type/_search?filter_path=hits.hits._source | jq '.hits.hits[]._source'
2020-06-22