# Set predefined filters based on users's info

**URL:** <https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130>\
**Category:** Kibana\
**Created:** [June 24, 2018, 1:11am UTC](https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130 "2018-06-24T01:11:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 24, 2018, 1:11am UTC](https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130/1 "2018-06-24T01:11:46Z")

</div>

Hi,

I have created a visualization in Kibana which filters data based on the group\_id field. Every user in kibana will have a group\_id field in their metadata info. I would like to use this value to be used as the filter instead of the user manually setting this value every time they access the dashboard.

Is this possible in Kibana?

For example I have the following users and sales data

**Users**  
{  
"username": user-a,  
"group\_id": 1  
},  
User-B  
{  
"username": user-b,  
"group\_id": 2  
}

**Sales Data (index)**  
{  
"sale\_id": 001,  
"sale\_date": "2018-06-20",  
"amount": 35.50,  
"group\_id": 1  
},  
{  
"sale\_id": 003,  
"sale\_date": "2018-06-20",  
"amount": 3.90,  
"group\_id": 2  
},  
{  
"sale\_id": 001,  
"sale\_date": "2018-06-20",  
"amount": 100.00  
"group\_id": 2  
}

======

In my visual

**user-a**

**Sale\_Date (Month) | Total Sales**  
2018-01-01 (Jan) | 35.50

**user-b**  
**Sale\_Date (Month) | Total Sales**  
2018-01-01 (Jan) | 103.90

====

thanks

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 24, 2018, 6:11am UTC](https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130/2 "2018-06-24T06:11:44Z")

</div>

Using X-Pack Security and document level security, you can restrict access to subsets of documents based on user attributes as described in [this blog post](https://www.elastic.co/blog/securing-gdpr-personal-data-with-access-controls).

---

<div class="post-metadata">

**Author:** ![kenneth](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kenneth](https://discuss.elastic.co/u/kenneth)\
**Post date:** [June 24, 2018, 3:26pm UTC](https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130/3 "2018-06-24T15:26:21Z")

</div>

@Christian_Dahlqvist understood the topic of restricting access to data using document-level security access but what I would like to achieve is for each user accessing a visualization or dashboard (assuming the data set they are seeing are the ones they have access to) will have filter values applied based on their metadata info.

Assuming user-a and user-b both have access to the sales data (provided in previous post). I would like each user to see the filtered sales data that is more relevant to their group:

- user-a sees sales data with group\_id:1 by default  
(Then eventually user-a would be able change the filter say, group\_id = 2)
- user-b sees sales data with group\_Id:2 by default  
(Then eventually user-b would be able change the filter say, group\_id = 1)

-

---

<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 22, 2018, 3:26pm UTC](https://discuss.elastic.co/t/set-predefined-filters-based-on-userss-info/137130/4 "2018-07-22T15:26:26Z")

</div>

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