# Enabling Document Level Security from Kibana Management Console

**URL:** https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467
**Category:** Kibana
**Tags:** elastic-stack-security
**Created:** [October 29, 2018, 4:13pm UTC](https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467 "2018-10-29T16:13:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nikhil.bokil](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nikhil.bokil](https://discuss.elastic.co/u/nikhil.bokil)
#### Post date: [October 29, 2018, 4:13pm UTC](https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467/1 "2018-10-29T16:13:02Z")

</div>

I have a demo index which contains State as keyword, the data obviously contains multiple records for the same State.  
I have users with names that are actual State names in the data.  
eg State: Alabama and user full name : Alabama  
State: Florida and user full name : Florida

Q: How to write the Granted Documents Query from Kibana Role Creation menu, where I can just filter the document which contains the State : user full name?

I have tried this:  
{"term": {"ResidingState.keyword":"{\_user.full\_name}"}}

but the visualization is not showing up, " No results displayed because all values equal 0." is the message shown up in the visualization.

Any help is much appreciated.

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [October 30, 2018, 7:27am UTC](https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467/2 "2018-10-30T07:27:40Z")

</div>

Hi,

Have you read through our [documentation](https://www.elastic.co/guide/en/x-pack/current/field-and-document-access-control.html#document-level-security)? I'm sure you will find the DLS section very helpful. You can do this with a [templated query](https://www.elastic.co/guide/en/x-pack/current/field-and-document-access-control.html#templating-role-query), like:

```auto
PUT _xpack/security/role/test_dls
{
  "indices" : [
    {
      "names" : ["your_index_name_here"],
      "privileges" : ["read"],
      "query" : {
        "template" : {
          "source" : {
            "term" : { "ResidingState" : "{{_user.full_name}}" }
          }
        }
      }
    }
  ]
}

```

---

<div class="post-metadata">

### Author: ![nikhil.bokil](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nikhil.bokil](https://discuss.elastic.co/u/nikhil.bokil)
#### Post date: [October 30, 2018, 8:10am UTC](https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467/3 "2018-10-30T08:10:51Z")

</div>

> [@ikakavas](#):
>
> m sure you will find the DLS section very helpful. You can do this with a [templated query](https://www.elastic.co/guide/en/x-pack/current/field-and-document-access-control.html#templating-role-query), like:

It worked... Thanks Ioannis

---

<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: [November 27, 2018, 8:10am UTC](https://discuss.elastic.co/t/enabling-document-level-security-from-kibana-management-console/154467/4 "2018-11-27T08:10:52Z")

</div>

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