gpt4 book ai didi

elasticsearch - Elasticsearch中的数据屏蔽

转载 作者:行者123 更新时间:2023-12-03 00:02:37 25 4
gpt4 key购买 nike

我想知道有什么方法可以通过elasticsearch inbuild功能实现以下用例。

我在Elasticsearch搜索中索引了员工数据

EMP ID FNAME LNAME COUNTRY Organization Other 50 Attributes associated with Employee

1 Jayesh Bhoyar United States ABC

2 Tapan pal United States ABC

3 Ajay United States ABC

4 Ravi Verma Korea ABC

7 Pankaj Pal Korea ABC

5 Sundar Lal Japan ABC

6 rahul Sri Japan ABC



现在我们有4个用户及其访问级别:

用户1-有权访问美国

用户2-可以访问美国,日本

用户3-可以访问美国,韩国

User4-可以访问美国,日本,韩国

用户1

Now when User 1 search ABC he should get 7 results but output should be as follows:

EMP ID FNAME LNAME COUNTRY Organization Other 50 Attributes associated with Employee

1 Jayesh Bhoyar United States ABC

2 Tapan pal United States ABC

3 Ajay United States ABC

XXX XXX XXX Korea XXX XXXXXXXX

XXX XXX XXX Korea XXX XXXXXXXX

XXX XXX XXX Japan XXX XXXXXXXX

XXX XXX XXX Japan XXX XXXXXXXX



用户2

Now when User 2 search ABC he should get 7 results but output should be as follows:

He should be able to see the Japan results and korean results should be masked

EMP ID FNAME LNAME COUNTRY Organization Other 50 Attributes associated with Employee

1 Jayesh Bhoyar United States ABC

2 Tapan pal United States ABC

3 Ajay United States ABC

XXX XXX XXX Korea XXX XXXXXXXX

XXX XXX XXX Korea XXX XXXXXXXX

5 Sundar Lal Japan ABC

6 rahul Sri Japan ABC



用户3

Now when User 3 search ABC he should get 7 results but output should be as follows:

He should be able to see the Korean results and Japan results should be masked

EMP ID FNAME LNAME COUNTRY Organization Other 50 Attributes associated with Employee

1 Jayesh Bhoyar United States ABC

2 Tapan pal United States ABC

3 Ajay United States ABC

4 Ravi Verma Korea ABC

7 Pankaj Pal Korea ABC

XXX XXX XXX Japan XXX XXXXXXXX

XXX XXX XXX Japan XXX XXXXXXXX



有什么方法可以通过脚本或跨度或其他在Elasticsearch中内置的方法来实现

最佳答案

通常,这是您应该在后端执行的操作,而不是elasticsearch。第一步是获取权限数据,第二步是使用取决于第一步的过滤器构建查询。

关于elasticsearch - Elasticsearch中的数据屏蔽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47597967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com