# Search cretiria with TermSet

**URL:** https://discuss.elastic.co/t/search-cretiria-with-termset/304459
**Category:** Elasticsearch
**Created:** [May 11, 2022, 11:44am UTC](https://discuss.elastic.co/t/search-cretiria-with-termset/304459 "2022-05-11T11:44:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![srikanthkadem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanthkadem/32/40018_2.png) [@srikanthkadem](https://discuss.elastic.co/u/srikanthkadem)
#### Post date: [May 11, 2022, 11:44am UTC](https://discuss.elastic.co/t/search-cretiria-with-termset/304459/1 "2022-05-11T11:44:55Z")

</div>

Hi All,  
I have requirement to search Elastic with following details . This is part of security implementation you can assume for my website.  
I have different Grouptypes with each group type having set of Groups . these groups are assosiated with Job as well as users.

so to implement security to job , we need to follow the below approach.  
if the job having multiple groups[of different group types] , user should have atleast 1 group match with the matched grouptype and we should nt worry/validate if the jobgrouptype is not part of usergroup type.

example is explained below

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/f/4f5f45013ddf351e2c5f58da4a3c394c345243a1.png)

Earlier I used to match only groups directly that I achieved through Terms Set Query based on suggestion given in [Array intersection](https://discuss.elastic.co/t/array-intersection/167120) . This is next level of requirement , I need inputs on how to maintain job data in Elastic and user group info will be part of Search query based on logged-in user.

C# way of implementation is provided below for better understanding, we need similar logic to work with Elasticsearch query.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/9/394eb24fd0f2854cb98178b29bddeaf698459c07.png)

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [May 11, 2022, 12:03pm UTC](https://discuss.elastic.co/t/search-cretiria-with-termset/304459/2 "2022-05-11T12:03:46Z")

</div>

Hey,

it would be easier to explain the concept you want to use instead of pasting screenshots with code of a programming language that not everyone understands 🙂 also please use code snippets instead of screenshots.

Maybe [Document-Level Attribute-Based Access Control in Elasticsearch | Elastic Blog](https://www.elastic.co/blog/attribute-based-access-control-elasticsearch) can give you a slight idea how to move forward. If not, feel free to add some more detail.

--Alex

---

<div class="post-metadata">

### Author: ![srikanthkadem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srikanthkadem/32/40018_2.png) [@srikanthkadem](https://discuss.elastic.co/u/srikanthkadem)
#### Post date: [May 11, 2022, 12:38pm UTC](https://discuss.elastic.co/t/search-cretiria-with-termset/304459/3 "2022-05-11T12:38:28Z")

</div>

Hey Alex,  
Thanks for the response, I explained the concept and additionally shared some code (if explanation is not enough to get the concept). I will look into the links shared by you and comeback if that helps to serve my purpose.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 8, 2022, 12:39pm UTC](https://discuss.elastic.co/t/search-cretiria-with-termset/304459/4 "2022-06-08T12:39:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
