# Kibana Granted document query for multiple filter

**URL:** <https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [December 14, 2020, 3:58pm UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607 "2020-12-14T15:58:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjali28](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anjali28](https://discuss.elastic.co/u/anjali28)\
**Post date:** [December 14, 2020, 3:58pm UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607/1 "2020-12-14T15:58:20Z")

</div>

Hello,

I have an requirement of creating a role which has limited permission of data in index privileges using granted document query.

For example: User1 should be restricted when installation id: 1 and stageid:2 d matches in granted document query. Applied with the following query but its not working.

{  
"query": {  
"bool": {  
"filter": [{  
"match": {  
"installationid": "JohnMX"  
}  
},  
{  
"match": {  
"stageid": "UAT"  
}  
}  
]  
}  
}  
}

Data is coming blank as there is data in it.

kindly suggest me with different query or share some link for how to write query in kibana\>Roles\>Indexprivileges\>Granted document query.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [December 15, 2020, 12:29am UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607/2 "2020-12-15T00:29:02Z")

</div>

If that's a literal copy of what you entered, then the issue is that you have a top-level `"query"` field.

The DLS query is a _query_ not a _search_, so it should be:

```auto
{
  "bool": {
    "filter": [
      {
        "match": {
          "installationid": "JohnMX"
        }
      },
      {
        "match": {
          "stageid": "UAT"
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![anjali28](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anjali28](https://discuss.elastic.co/u/anjali28)\
**Post date:** [December 15, 2020, 7:37am UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607/3 "2020-12-15T07:37:35Z")

</div>

@TimV Thanks alot, now my query is working properly!!

---

<div class="post-metadata">

**Author:** ![anjali28](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@anjali28](https://discuss.elastic.co/u/anjali28)\
**Post date:** [January 6, 2021, 6:31am UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607/4 "2021-01-06T06:31:25Z")

</div>

Hello TimV,

I have another requirment for the granted document query level in kibana roles tab.

For Example: User1 should be restricted to customer id: 1 and installation id: 1 and  
Stage id: {1,2,3} n granted document query.

Applied with the following query but its not working.

{  
"bool": {  
"filter": [  
{  
"match": {  
"customerid": "John"  
}  
},  
{  
"match": {  
"installationid": "JohnMX"  
}  
},  
{

```
	"terms": {
      "stageid": ["PAT", "UAT"]
	  }
	}
]	 

```

}  
}

Please help

Regards,  
Anjali

---

<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:** [February 3, 2021, 6:31am UTC](https://discuss.elastic.co/t/kibana-granted-document-query-for-multiple-filter/258607/5 "2021-02-03T06:31:28Z")

</div>

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