如何创建排除特定字段的elasticsearch索引别名 [英] How to create elasticsearch index alias that excludes specific fields

查看:382
本文介绍了如何创建排除特定字段的elasticsearch索引别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Elasticsearch的索引别名在更完整的索引上创建受限制的视图来支持传统的搜索应用程序。这很好。但是,我也想从返回的结果中排除某些敏感字段(它们包含电子邮件地址,并且我们希望排除收获。)

以下是我的:

  PUT全索引/ _alias / restricted-index-alias 
{
_source:{
exclude:[field_with_email]
},
filter:{
term:{indexflag:noindex}
}



$ b

这适用于查询(我没有看到field_with_email)和过滤条件工作(我得到一个受限制的索引),但我仍然在索引别名的查询结果中看到field_with_email



这是应该工作?

(我不希望从映射中的_source中排除,因为我也使用了部分更新;如果整个文档在_source中可用,这些更容易)

解决方案

不,它不应该工作,并且文档不建议它可以工作。

I'm using Elasticsearch's index aliases to create restricted views on a more-complete index to support a legacy search application. This works well. But I'd also like to exclude certain sensitive fields from the returned result (they contain email addresses, and we want to preclude harvesting.)

Here's what I have:

PUT full-index/_alias/restricted-index-alias
{
    "_source": {
      "exclude": [ "field_with_email" ]
    },
  "filter": {
    "term": { "indexflag": "noindex" }
  }
}

This works for queries (I don't see field_with_email), and the filter term works (I get a restricted index) but I still see the field_with_email in query results from the index alias.

Is this supposed to work?

(I don't want to exclude from _source in the mapping, as I'm also using partial updates; these are easier if the entire document is available in _source.)

解决方案

No, it is not supposed to work, and the documentation doesn't suggest that it should work.

这篇关于如何创建排除特定字段的elasticsearch索引别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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