# Kibana global filter isn't applied to Vega-lite visualizations

**URL:** <https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [December 14, 2022, 11:14am UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210 "2022-12-14T11:14:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ysattvik](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@ysattvik](https://discuss.elastic.co/u/ysattvik)\
**Post date:** [December 14, 2022, 11:14am UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210/1 "2022-12-14T11:14:18Z")

</div>

Hi there,

I am using Kibana version 8.5.0  
I have added some visualizations made in Kibana and some custom visualizations made in Vega-lite on a single dashboard. When I am trying to filter data on the basis control or global filter available on dashboard, so visualizations made in Kibana are changed as per the filter, but visualizations made in Vega-lite are not changed as per the global filter.

I am searching a solution for that, and I have tried some of the solution available here like adding  
%context%: true

Some other code like

"query": {  
"bool": {  
"must": [  
"%dashboard\_context-must\_clause%",  
{  
"range": {  
"eventTime": {"%timefilter%": true}  
}  
}  
],  
"must\_not": ["%dashboard\_context-must\_not\_clause%"],  
"filter": [  
{  
"term": {"status": 0}  
}  
]  
}  
}

Please help me to resolve this problem.

---

<div class="post-metadata">

**Author:** ![ysattvik](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@ysattvik](https://discuss.elastic.co/u/ysattvik)\
**Post date:** [December 15, 2022, 4:11am UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210/2 "2022-12-15T04:11:38Z")

</div>

My code is this  
{  
$schema: [https://vega.github.io/schema/vega-lite/v2.json](https://vega.github.io/schema/vega-lite/v2.json)  
"config": {"view": {"width": 400, "height": 300}, "mark": {"tooltip": false}},  
"title": {  
"text": "Scheme Details",  
"anchor": "middle"  
},  
data: {  
url: {  
%context%: true  
index: krishi\_maual\_data2  
body: {  
size: 10000  
\_source: [  
"@timestamp"  
"channel"  
"Scheme"  
"FinancialInstitutions"  
"Ministry"  
"State"  
]  
}  
}  
format: { property: "hits.hits" }  
}  
"mark": "bar",  
"encoding": {  
"color": {"type": "nominal", "field": "\_source.Scheme.name", "title": "Scheme"},  
"y": { "field": "\_source.@timestamp", "type": "ordinal", "timeUnit": "month", "title": "Time"},  
"x": { "aggregate":"sum", "type": "quantitative", "field": "value", "title": ""},  
"tooltip": [  
{  
aggregate: sum  
"field": "value",  
"type": "quantitative"  
title: Total  
},  
{  
"field": "\_source.Scheme.name",  
"type": "ordinal"  
title: "Scheme"  
}  
]  
},  
"selection": {  
"selector006": {  
"type": "single",  
"fields": ["Select"],  
"bind": {  
"input": "select",  
"options": ["\_source.Scheme.app\_applied", "\_source.Scheme.app\_approved", "\_source.Scheme.amount\_approved", "\_source.Scheme.amount\_disbursed"],  
"labels":["Application Applied(in No.)", "Application Approved(in No.)", "Amount Approved(in Cr.)", "Amount Disbursed(in Cr.)"]  
"name": "Select"  
},  
"init": {"Select": "\_source.Scheme.app\_applied"}  
}  
},  
"transform": [  
{  
"fold": ["\_source.Scheme.app\_applied", "\_source.Scheme.app\_approved", "\_source.Scheme.amount\_approved","\_source.Scheme.amount\_disbursed"],  
"as": ["Select", "value"]  
},  
{"filter": {"selection": "selector006"}}  
]  
}

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [December 23, 2022, 7:52pm UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210/3 "2022-12-23T19:52:26Z")

</div>

I tried to reproduce this in my 8.5.3 and I couldn't.

cc @drewdaemon / @Marta_Bondyra any inputs?

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![ysattvik](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@ysattvik](https://discuss.elastic.co/u/ysattvik)\
**Post date:** [December 24, 2022, 10:38am UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210/4 "2022-12-24T10:38:01Z")

</div>

Hi \< bhavyarm\>

thanks to you for reply.

I think, I did it by adding the @timestamp in URL section in each Vega- Lite visualizations as %timefield%: @timestamp. After adding this when we change the time from time slider like 30 days, 90 days etc, the changes reflect on each Vega-Lite visualizations.

data: {  
url: {  
%context%: true  
%timefield%: @timestamp  
index: krishi\_maual\_data2  
body: {  
size: 10000  
\_source: [  
"@timestamp"  
"channel"  
"Scheme"  
"FinancialInstitutions"  
"Ministry"  
"State"  
]  
}  
}  
format: { property: "hits.hits" }  
}

---

<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:** [January 21, 2023, 10:38am UTC](https://discuss.elastic.co/t/kibana-global-filter-isnt-applied-to-vega-lite-visualizations/321210/5 "2023-01-21T10:38:28Z")

</div>

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