# Index data level security

**URL:** https://discuss.elastic.co/t/index-data-level-security/332843
**Category:** Kibana
**Created:** [May 8, 2023, 8:46pm UTC](https://discuss.elastic.co/t/index-data-level-security/332843 "2023-05-08T20:46:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Msacs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/msacs/32/118032_2.png) [@Msacs](https://discuss.elastic.co/u/Msacs)
#### Post date: [May 8, 2023, 8:46pm UTC](https://discuss.elastic.co/t/index-data-level-security/332843/1 "2023-05-08T20:46:45Z")

</div>

Wanted some guidance on how to setup data level security . I have a index with a field plant\_id and I have user list that I intend to map users to the corresponding plant id and when users searches ES or access Kibana dashboard they can only see there corresponding plant id documents. Please advice

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [May 10, 2023, 10:42am UTC](https://discuss.elastic.co/t/index-data-level-security/332843/2 "2023-05-10T10:42:51Z")

</div>

You‘re looking for document level security: [Document level security | Elasticsearch Guide [8.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/document-level-security.html)

Is that enough of a pointer to get you started?

---

<div class="post-metadata">

### Author: ![Msacs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/msacs/32/118032_2.png) [@Msacs](https://discuss.elastic.co/u/Msacs)
#### Post date: [May 10, 2023, 6:10pm UTC](https://discuss.elastic.co/t/index-data-level-security/332843/3 "2023-05-10T18:10:12Z")

</div>

Thanks Xerra. Appreciate your response. Could you please guide me how to map user to the underlying documents? We have around 3000 users and can we load those users into an index or import directly from excel and map to the index column (plant\_id) to the corresponding users? if yes can u point me to the steps please?

POST /\_security/role/dept\_role  
{  
"indices" : [  
{  
"names" : ["\*"],  
"privileges" : ["read"],  
"query" : {  
"term" : { "department\_id" : 12 }  
}  
}  
]  
}

---

<div class="post-metadata">

### Author: ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)
#### Post date: [May 15, 2023, 12:38pm UTC](https://discuss.elastic.co/t/index-data-level-security/332843/4 "2023-05-15T12:38:44Z")

</div>

The mapping is generally: You create a role (like department ID 12) and then assign a user to one (or more) departments. Besides creating user manually in Kibana, you could also do that through the API or, if you have a lot of users, you might want to rely on an external tool like LDAP,... 3,000 users sounds a lot for onboarding and off-boarding, so an SSO solution might make more sense?

As a sidenote, if the mapping of departments is tedious, you could also look into Attribute Based Access Control (ABAC): [Document-Level Attribute-Based Access Control in Elasticsearch | Elastic Blog](https://www.elastic.co/blog/attribute-based-access-control-elasticsearch)

PS: Both document-level security and SSO are paid features of the Elastic Stack (or part of Elastic Cloud).

---

<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 12, 2023, 12:39pm UTC](https://discuss.elastic.co/t/index-data-level-security/332843/5 "2023-06-12T12:39:04Z")

</div>

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