How to create elasticsearch index alias that excludes specific fields

可紊 提交于 2019-12-11 07:42:16

问题


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.)


回答1:


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



来源:https://stackoverflow.com/questions/26349705/how-to-create-elasticsearch-index-alias-that-excludes-specific-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!