# Document groups privileges

**URL:** https://discuss.elastic.co/t/document-groups-privileges/148337
**Category:** Elasticsearch
**Created:** [September 12, 2018, 1:36pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337 "2018-09-12T13:36:35Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![zalpany2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zalpany2000/32/12596_2.png) [@zalpany2000](https://discuss.elastic.co/u/zalpany2000)
#### Post date: [September 12, 2018, 1:36pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/1 "2018-09-12T13:36:35Z")

</div>

Hello Elasticers

have anyone experience with having different groups of documents each have certain access privileges from certain users? I mean for editing or adding new documents into this group?

the case is that, we want to use ES as a single data repository for multiple projects, but each project should feed ES with his own documents, each project should be stand alone in document creation and editing, and they wish that not every user with edit privilege can edit all documents, just the assigned group. is it possible? any use case?

thanks

Hossam

---

<div class="post-metadata">

### Author: ![jaddison](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@jaddison](https://discuss.elastic.co/u/jaddison)
#### Post date: [September 12, 2018, 3:30pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/2 "2018-09-12T15:30:48Z")

</div>

I haven't researched this, but I imagine the best approach is simply to have a 'groupID' `keyword` field and require that all of your queries use a `term` filter against this field.

---

<div class="post-metadata">

### Author: ![zalpany2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zalpany2000/32/12596_2.png) [@zalpany2000](https://discuss.elastic.co/u/zalpany2000)
#### Post date: [September 12, 2018, 5:44pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/3 "2018-09-12T17:44:02Z")

</div>

Jello james, many thanks for your reply, the query part is okay to Handel, I mean the documents adding and editing part.

---

<div class="post-metadata">

### Author: ![jaddison](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@jaddison](https://discuss.elastic.co/u/jaddison)
#### Post date: [September 12, 2018, 6:02pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/4 "2018-09-12T18:02:56Z")

</div>

I must have read too quickly, my apologies. Overall, it sounds like something you'd need to handle in your app code.

- when saving a new doc, set the group and only save it with that group if the user is allowed to
- when editing a doc, retrieve it first, and compare whether the user is allowed to modify docs in that group

I guess have a separate index for users/groups pairings as well?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 12, 2018, 10:04pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/5 "2018-09-12T22:04:20Z")

</div>

[Security](https://www.elastic.co/products/stack/security) will do what you want. You should also consider having an index per project, assuming you won't have massive amounts of projects.

---

<div class="post-metadata">

### Author: ![zalpany2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zalpany2000/32/12596_2.png) [@zalpany2000](https://discuss.elastic.co/u/zalpany2000)
#### Post date: [September 13, 2018, 7:10am UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/6 "2018-09-13T07:10:39Z")

</div>

something like 100 ?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 13, 2018, 8:24am UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/7 "2018-09-13T08:24:13Z")

</div>

Then an index per project is ok. If it were thousands it'd be different.

---

<div class="post-metadata">

### Author: ![zalpany2000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zalpany2000/32/12596_2.png) [@zalpany2000](https://discuss.elastic.co/u/zalpany2000)
#### Post date: [September 13, 2018, 9:56am UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/8 "2018-09-13T09:56:34Z")

</div>

hello Mark,

I checked the link for the Security you provided, I guess I am still lost about how it can be feasible specially from sys admin prospective not developers prospective, I tried to visualise tha Idea we want to achieve in the next image

we need to build different apps can use ES as data storage and search engine, sure each app will use it's own index, this is not the issue, the issue we need to be sure that the apps cannot interfere with each other when it comes to documents adding, editing and so on, some apps should be able to build indexes using different documents groups as index 5 in Picture.

is is simply feasible and where to find more documentation or consultation for that ?

all the best

 ![es2](https://us1.discourse-cdn.com/elastic/original/3X/9/9/99f6f02cfe90b88db1c5601aa42f51ffd1bdeec0.png)

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 13, 2018, 9:21pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/9 "2018-09-13T21:21:07Z")

</div>

> [@zalpany2000](#):
>
> we need to be sure that the apps cannot interfere with each other when it comes to documents adding, editing and so on

Right, so Security can restrict access to ensure this.

> [@zalpany2000](#):
>
> some apps should be able to build indexes using different documents groups as index 5 in Picture.

There's no index 5 there. But again, Security can stop specific apps from doing specific things.

---

<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: [October 11, 2018, 9:21pm UTC](https://discuss.elastic.co/t/document-groups-privileges/148337/10 "2018-10-11T21:21:18Z")

</div>

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