How to create elasticsearch index alias that exclu

2019-07-22 15:39发布

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条回答
混吃等死
2楼-- · 2019-07-22 16:07

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

查看更多
登录 后发表回答