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

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

问题描述

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



过滤掉元数据字段,并仅在elasticsearch中返回源字段



链接的插件就是这个:



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



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



谢谢,
Jim p>

响应过滤,它不是插件,而是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’


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:

Filter out metadata fields and only return source fields in elasticsearch

The plugin that was linked was this one:

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

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

Thanks, Jim

解决方案

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

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天全站免登陆