在弹性搜索中保护数据 [英] Protecting data in elastic search
本文介绍了在弹性搜索中保护数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个在本地运行的弹性搜索引擎,其索引包含来自多个客户的数据.当客户进行查询时,有一种方法可以在过滤条件中动态添加客户ID,以便客户无法访问其他客户的记录.
I have a elastic search engine running locally with an index which contains data from Multiple customers. When a customer makes a query, is there a way to dynamically add Customer Id in the filtering criteria so a customer cannot access the records from other customers.
推荐答案
Yes, you can achieve that using filtered aliases. So you'd create one alias per customer like this:
POST /_aliases
{
"actions" : [
{
"add" : {
"index" : "customer_index",
"alias" : "customer_1234",
"filter" : { "term" : { "customer_id" : "1234" } }
}
}
]
}
然后,您的客户只需查询别名 customer_1234
,就只会返回他的数据.
Then your customer can simply query the alias customer_1234
and only his data is going to come back.
这篇关于在弹性搜索中保护数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文