Enabling Document Level Security from Kibana Management Console

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.


Have you read through our documentation? I'm sure you will find the DLS section very helpful. You can do this with a templated query, like:

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

It worked... Thanks Ioannis

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