只需要返回源字段,没有任何元数据 - 如何使用插件? [英] Need to return source fields only, without any metadata - how to use plugin?

查看:8
本文介绍了只需要返回源字段,没有任何元数据 - 如何使用插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要求只返回搜索结果中的源字段,不返回任何元数据.从搜索中,我认为这在 elasticsearch 中是不可能的,但我确实找到了可能在此线程中使用插件的参考:

We have a requirement that we return just the source fields in search results, without any of the metadata. From searching, I gather that this is not possible with elasticsearch, but I did find a reference to maybe using a plugin in this thread:

过滤元数据字段,只返回elasticsearch中的源字段

链接的插件是这个:

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

我仍在学习 elasticsearch,但谁能解释一下我将如何在我们的 elasticsearch 配置中实现和部署该插件?

I'm still learning about elasticsearch, but can someone explain how I would implement and deploy that plugin in our elasticsearch configuration?

谢谢,吉姆

推荐答案

如您引用的第一个链接所述,可以使用 响应过滤 这不是插件而是 ES 的标准特性:

As stated in the first link you referenced, it is possible to do it with response filtering which is not a plugin but a standard feature of ES:

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

如果你想摆脱 hits.hits._source 你可以使用 <代码>jq

If you want to get rid of hits.hits._source you can use jq

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

这篇关于只需要返回源字段,没有任何元数据 - 如何使用插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆