# Grant privileges to specific documents, Kibana Role

**URL:** <https://discuss.elastic.co/t/grant-privileges-to-specific-documents-kibana-role/238000>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [June 22, 2020, 5:11am UTC](https://discuss.elastic.co/t/grant-privileges-to-specific-documents-kibana-role/238000 "2020-06-22T05:11:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [June 22, 2020, 5:11am UTC](https://discuss.elastic.co/t/grant-privileges-to-specific-documents-kibana-role/238000/1 "2020-06-22T05:11:45Z")

</div>

Hi Im currently using this query for privileges to specifics documents

```auto
{
"terms":{
"host.keyword":["meli","cmai","moja"]
}
}

```

But now I need to grant privileges to the documents that has a specific field "metrics" along with the above query

In words will be something like this:

```auto
grant privileges to the documents which host are "meli","cmai","moja" and that the field "metric" exist

```

how can I mix this two conditions to filter the documents?

Thanks!

---

<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:** [June 23, 2020, 11:01pm UTC](https://discuss.elastic.co/t/grant-privileges-to-specific-documents-kibana-role/238000/2 "2020-06-23T23:01:43Z")

</div>

Does [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html) help?

---

<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:** [July 21, 2020, 11:01pm UTC](https://discuss.elastic.co/t/grant-privileges-to-specific-documents-kibana-role/238000/3 "2020-07-21T23:01:48Z")

</div>

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