# Need to apply filter to KIBANA dashboard automatically through html

**URL:** <https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122>\
**Category:** Kibana\
**Created:** [December 28, 2022, 8:29pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122 "2022-12-28T20:29:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shashank02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shashank02/32/99866_2.png) [@Shashank02](https://discuss.elastic.co/u/Shashank02)\
**Post date:** [December 28, 2022, 8:29pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/1 "2022-12-28T20:29:46Z")

</div>

My idea is that I have 2 cards - Virat Kohli and Leo Messi. And in the dashboard, I have 1 dashboard named "main" and in that, I have a filter called "event". In the "event" I have given 2 topics - viratkohli and lionelmessi. So, if I click one of the cards on the HTML page it should apply that filter in the dashboard and the results should be shown. Suppose I click on a Leo Messi card, in the dashboard named "main" the "event" should automatically change to "lionelmessi" and the changes should be applied. Is it possible? And if yes, how?

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [December 29, 2022, 5:27pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/2 "2022-12-29T17:27:37Z")

</div>

You can search this forum for similar questions, like this one

> [@Passing parameters or filter in kibana URL from Web-App](https://discuss.elastic.co/t/passing-parameters-or-filter-in-kibana-url-from-web-app/141568/2):
>
> the filters are part of url, take a look at this example: http://localhost:5601/beg/app/kibana#/dashboard/7adfa750-4c81-11e8-b3d7-01146121b73d?\_g=()&\_a=(description:'Analyze%20mock%20flight%20data%20for%20ES-Air,%20Logstash%20Airways,%20Kibana%20Airlines%20and%20JetBeats',filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:d3d7af60-4c81-11e8-b3d7-01146121b73d,key:Carrier,negate:!f,params:(query:'Logstash%20Airways',type:phrase),type:phrase,value:'Logstash%20Airways'),query:(ma…

Briefly, there is no public API for dashboard URL parameters so you need to inspect your URLs manually. or just copy the whole string for each case and update your iframe with it. In any case this is going to be weak and will need update with any upgrade of the stack.

Worth also mentioning that maybe you can do the full experience inside kibana using [drilldowns](https://www.elastic.co/guide/en/kibana/current/create-drilldowns.html) to offer a generic dashboard with the main options that navigates to a detailed dashboard filtered by the selected option.

---

<div class="post-metadata">

**Author:** ![Shashank02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shashank02/32/99866_2.png) [@Shashank02](https://discuss.elastic.co/u/Shashank02)\
**Post date:** [December 29, 2022, 6:25pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/3 "2022-12-29T18:25:42Z")

</div>

So, this is the link to my dashboard without applying the filter :  
[Elastic](https://social-media-analyzer.kb.ap-south-1.aws.elastic-cloud.com/app/dashboards?auth_provider_hint=anonymous1#/view/e1af0b80-8285-11ed-8b1c-73fa260fa999?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-1y%2Fd%2Cto%3Anow)))

And this is the link to my dashboard after applying the filter:  
[Elastic](https://social-media-analyzer.kb.ap-south-1.aws.elastic-cloud.com/app/dashboards?auth_provider_hint=anonymous1#/view/e1af0b80-8285-11ed-8b1c-73fa260fa999?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-1y%2Fd%2Cto%3Anow)))

There is no change between the links whatsoever. So, how do I make it dynamic so as to access the dashboard only for the certain card?

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [December 30, 2022, 11:30am UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/4 "2022-12-30T11:30:42Z")

</div>

You need a _snapshot URL_, available on the share menu on the top right corner

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bffa8fe5d412e2008d5f3c682ec33f538be1d0a2.png)

So for example, for that dashboard from the screenshot above about New York city 311 calls I can filter:

- [illegal parking issues](https://jorge-sanz.kb.eastus2.azure.elastic-cloud.com:9243/s/public/app/dashboards?auth_provider_hint=anonymous1#/view/4c1c2b60-8e5d-11ec-ae6b-fd283f38af31?_g=(filters:!())&_a=(description:'',filters:!(('%24state':(store:appState),meta:(alias:'Noisy%20neighbors',disabled:!t,index:c66f1746-1a4e-4c14-9df4-1bc417d856a9,key:query,negate:!t,type:custom),query:(bool:(should:!((bool:(must:!((exists:(field:coordinates)),(geo_shape:(coordinates:(relation:INTERSECTS,shape:(coordinates:!(!(!(-73.8606,40.89286),!(-73.8606,40.89156),!(-73.85871,40.89156),!(-73.85871,40.89286),!(-73.8606,40.89286))),type:Polygon)),ignore_unmapped:!t))))),(bool:(must:!((exists:(field:location)),(geo_shape:(ignore_unmapped:!t,location:(relation:INTERSECTS,shape:(coordinates:!(!(!(-73.8606,40.89286),!(-73.8606,40.89156),!(-73.85871,40.89156),!(-73.85871,40.89286),!(-73.8606,40.89286))),type:Polygon))))))))))),('%24state':(store:appState),meta:(alias:!n,disabled:!f,index:c66f1746-1a4e-4c14-9df4-1bc417d856a9,key:'Complaint%20Type',negate:!f,params:(query:'Illegal%20Parking'),type:phrase),query:(match_phrase:('Complaint%20Type':'Illegal%20Parking')))),fullScreenMode:!f,options:(hidePanelTitles:!f,syncColors:!t,useMargins:!t),panels:!((embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-ff44e56c-6088-4dab-870e-1e6364a0b37e,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:(ff44e56c-6088-4dab-870e-1e6364a0b37e:(columnOrder:!('3d39f2eb-e1ea-49c9-b234-f5154bf59b97'),columns:('3d39f2eb-e1ea-49c9-b234-f5154bf59b97':(customLabel:!t,dataType:number,isBucketed:!f,label:'311%20Calls',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(accessor:'3d39f2eb-e1ea-49c9-b234-f5154bf59b97',layerId:ff44e56c-6088-4dab-870e-1e6364a0b37e,layerType:data,size:xl,textAlign:center,titlePosition:bottom)),title:'',type:lens,visualizationType:lnsLegacyMetric),enhancements:()),gridData:(h:8,i:'0a3c1518-4b5e-48dc-8d98-d12fea50b114',w:10,x:0,y:0),panelIndex:'0a3c1518-4b5e-48dc-8d98-d12fea50b114',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b':(columnOrder:!('19a96e3b-a2a6-47ec-9471-551a91e8e65c','982c30e2-1e76-4be7-bf22-bfab5e15e67b','94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0'),columns:('19a96e3b-a2a6-47ec-9471-551a91e8e65c':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Complaint%20Type',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0',type:column),orderDirection:desc,otherBucket:!t,size:5),scale:ordinal,sourceField:'Complaint%20Type'),'94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0':(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ ),'982c30e2-1e76-4be7-bf22-bfab5e15e67b':(dataType:date,isBucketed:!t,label:'Created%20Date',operationType:date_histogram,params:(includeEmptyRows:!t,interval:auto),scale:interval,sourceField:'Created%20Date')),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!('94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0'),layerId:'6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b',layerType:data,palette:(name:default,type:palette),position:top,seriesType:area_stacked,showGridlines:!f,splitAccessor:'19a96e3b-a2a6-47ec-9471-551a91e8e65c',xAccessor:'982c30e2-1e76-4be7-bf22-bfab5e15e67b')),legend:(isVisible:!t,legendSize:auto,position:right),preferredSeriesType:area_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:8,i:bdfec1e5-9d1a-4f2d-932f-9377bc331750,w:19,x:10,y:0),panelIndex:bdfec1e5-9d1a-4f2d-932f-9377bc331750,title:'Calls%20by%20complaint%20type',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-7c3aa603-f31f-4824-b341-8cfd21c009d2,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('7c3aa603-f31f-4824-b341-8cfd21c009d2':(columnOrder:!(b15bf0fc-2be4-44ee-a172-6e4413dc67cf,'833bebe3-1a9b-4a7e-bd81-7162e2fc0c10',be06f723-1423-4972-b955-8b221713c302),columns:('833bebe3-1a9b-4a7e-bd81-7162e2fc0c10':(dataType:date,isBucketed:!t,label:'Created%20Date',operationType:date_histogram,params:(includeEmptyRows:!t,interval:auto),scale:interval,sourceField:'Created%20Date'),b15bf0fc-2be4-44ee-a172-6e4413dc67cf:(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Borough',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:be06f723-1423-4972-b955-8b221713c302,type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:Borough),be06f723-1423-4972-b955-8b221713c302:(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!(be06f723-1423-4972-b955-8b221713c302),layerId:'7c3aa603-f31f-4824-b341-8cfd21c009d2',layerType:data,seriesType:area_percentage_stacked,splitAccessor:b15bf0fc-2be4-44ee-a172-6e4413dc67cf,xAccessor:'833bebe3-1a9b-4a7e-bd81-7162e2fc0c10')),legend:(isVisible:!t,legendSize:auto,position:right),preferredSeriesType:area_percentage_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:8,i:'3f1be536-8220-4204-874f-db1498034f12',w:19,x:29,y:0),panelIndex:'3f1be536-8220-4204-874f-db1498034f12',title:'%25%20calls%20per%20borough',type:lens,version:'8.5.0'),(embeddableConfig:(enhancements:(),hiddenLayers:!(),isLayerTOCOpen:!t,mapBuffer:(maxLat:41.24477,maxLon:-73.47656,minLat:40.44695,minLon:-74.17969),mapCenter:(lat:40.74794,lon:-73.87799,zoom:9.83),openTOCDetails:!('2ff8bb36-3945-43ce-a1ec-c98f54a3b298','230f84f9-77af-43d9-8712-e8feff6e2468')),gridData:(h:30,i:'65512498-1584-45a3-b45c-256acde35217',w:18,x:0,y:8),id:'32dcf680-8e5c-11ec-ae6b-fd283f38af31',panelIndex:'65512498-1584-45a3-b45c-256acde35217',type:map,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-8706c7a4-5c0d-4710-a9e0-eb1376f94dcb,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('8706c7a4-5c0d-4710-a9e0-eb1376f94dcb':(columnOrder:!('328e6658-99e9-4ec4-9673-8c2f1ab422d4','55e4f4ab-de64-43ec-abef-321b06df56d9','88e25f4b-282a-419f-8ad9-ab5fb684fc6c'),columns:('328e6658-99e9-4ec4-9673-8c2f1ab422d4':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Location%20Type',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'88e25f4b-282a-419f-8ad9-ab5fb684fc6c',type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:'Location%20Type'),'55e4f4ab-de64-43ec-abef-321b06df56d9':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Borough',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'88e25f4b-282a-419f-8ad9-ab5fb684fc6c',type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:Borough),'88e25f4b-282a-419f-8ad9-ab5fb684fc6c':(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!('88e25f4b-282a-419f-8ad9-ab5fb684fc6c'),layerId:'8706c7a4-5c0d-4710-a9e0-eb1376f94dcb',layerType:data,position:top,seriesType:bar_horizontal_stacked,showGridlines:!f,splitAccessor:'55e4f4ab-de64-43ec-abef-321b06df56d9',xAccessor:'328e6658-99e9-4ec4-9673-8c2f1ab422d4')),legend:(isVisible:!t,legendSize:auto,position:top),preferredSeriesType:bar_horizontal_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:30,i:'14fa2575-2646-4468-b0b6-55f6fddc7ad9',w:16,x:18,y:8),panelIndex:'14fa2575-2646-4468-b0b6-55f6fddc7ad9',title:'Location%20type%20and%20Boroughs',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-fb644217-211d-4215-82ac-080f2fb87f22,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:(fb644217-211d-4215-82ac-080f2fb87f22:(columnOrder:!('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77',f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e),columns:('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Agency%20Name',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e,type:column),orderDirection:desc,otherBucket:!t,size:15),scale:ordinal,sourceField:'Agency%20Name'),f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e:(customLabel:!t,dataType:number,isBucketed:!f,label:Calls,operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(layers:!((categoryDisplay:default,layerId:fb644217-211d-4215-82ac-080f2fb87f22,layerType:data,legendDisplay:default,legendSize:auto,metric:f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e,nestedLegend:!f,numberDisplay:percent,primaryGroups:!('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77'))),shape:treemap)),title:'',type:lens,visualizationType:lnsPie),enhancements:(),hidePanelTitles:!f),gridData:(h:30,i:'39eabf4e-2341-43b8-97f6-a9de5886e94a',w:14,x:34,y:8),panelIndex:'39eabf4e-2341-43b8-97f6-a9de5886e94a',title:Agencies,type:lens,version:'8.5.0')),query:(language:kuery,query:''),tags:!('491469a0-8e5d-11ec-ae6b-fd283f38af31','7bf77380-8e5d-11ec-ae6b-fd283f38af31'),timeRange:(from:'2018-12-31T23:00:00.000Z',to:'2020-12-31T23:00:00.000Z'),timeRestore:!t,title:'%F0%9F%97%BD%20NYC%20311%20%F0%9F%97%BD',viewMode:view))
- [noise in the street](https://jorge-sanz.kb.eastus2.azure.elastic-cloud.com:9243/s/public/app/dashboards?auth_provider_hint=anonymous1#/view/4c1c2b60-8e5d-11ec-ae6b-fd283f38af31?_g=(filters:!())&_a=(description:'',filters:!(('%24state':(store:appState),meta:(alias:'Noisy%20neighbors',disabled:!t,index:c66f1746-1a4e-4c14-9df4-1bc417d856a9,key:query,negate:!t,type:custom),query:(bool:(should:!((bool:(must:!((exists:(field:coordinates)),(geo_shape:(coordinates:(relation:INTERSECTS,shape:(coordinates:!(!(!(-73.8606,40.89286),!(-73.8606,40.89156),!(-73.85871,40.89156),!(-73.85871,40.89286),!(-73.8606,40.89286))),type:Polygon)),ignore_unmapped:!t))))),(bool:(must:!((exists:(field:location)),(geo_shape:(ignore_unmapped:!t,location:(relation:INTERSECTS,shape:(coordinates:!(!(!(-73.8606,40.89286),!(-73.8606,40.89156),!(-73.85871,40.89156),!(-73.85871,40.89286),!(-73.8606,40.89286))),type:Polygon))))))))))),('%24state':(store:appState),meta:(alias:!n,disabled:!f,index:c66f1746-1a4e-4c14-9df4-1bc417d856a9,key:'Complaint%20Type',negate:!f,params:(query:'Noise%20-%20Street%2FSidewalk'),type:phrase),query:(match_phrase:('Complaint%20Type':'Noise%20-%20Street%2FSidewalk')))),fullScreenMode:!f,options:(hidePanelTitles:!f,syncColors:!t,useMargins:!t),panels:!((embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-ff44e56c-6088-4dab-870e-1e6364a0b37e,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:(ff44e56c-6088-4dab-870e-1e6364a0b37e:(columnOrder:!('3d39f2eb-e1ea-49c9-b234-f5154bf59b97'),columns:('3d39f2eb-e1ea-49c9-b234-f5154bf59b97':(customLabel:!t,dataType:number,isBucketed:!f,label:'311%20Calls',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(accessor:'3d39f2eb-e1ea-49c9-b234-f5154bf59b97',layerId:ff44e56c-6088-4dab-870e-1e6364a0b37e,layerType:data,size:xl,textAlign:center,titlePosition:bottom)),title:'',type:lens,visualizationType:lnsLegacyMetric),enhancements:()),gridData:(h:8,i:'0a3c1518-4b5e-48dc-8d98-d12fea50b114',w:10,x:0,y:0),panelIndex:'0a3c1518-4b5e-48dc-8d98-d12fea50b114',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b':(columnOrder:!('19a96e3b-a2a6-47ec-9471-551a91e8e65c','982c30e2-1e76-4be7-bf22-bfab5e15e67b','94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0'),columns:('19a96e3b-a2a6-47ec-9471-551a91e8e65c':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Complaint%20Type',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0',type:column),orderDirection:desc,otherBucket:!t,size:5),scale:ordinal,sourceField:'Complaint%20Type'),'94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0':(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ ),'982c30e2-1e76-4be7-bf22-bfab5e15e67b':(dataType:date,isBucketed:!t,label:'Created%20Date',operationType:date_histogram,params:(includeEmptyRows:!t,interval:auto),scale:interval,sourceField:'Created%20Date')),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!('94084c1e-62c0-4b22-bc07-1e6e1c8b6ee0'),layerId:'6a3b1bbf-9f6a-4a28-b0e6-3bc39a36e37b',layerType:data,palette:(name:default,type:palette),position:top,seriesType:area_stacked,showGridlines:!f,splitAccessor:'19a96e3b-a2a6-47ec-9471-551a91e8e65c',xAccessor:'982c30e2-1e76-4be7-bf22-bfab5e15e67b')),legend:(isVisible:!t,legendSize:auto,position:right),preferredSeriesType:area_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:8,i:bdfec1e5-9d1a-4f2d-932f-9377bc331750,w:19,x:10,y:0),panelIndex:bdfec1e5-9d1a-4f2d-932f-9377bc331750,title:'Calls%20by%20complaint%20type',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-7c3aa603-f31f-4824-b341-8cfd21c009d2,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('7c3aa603-f31f-4824-b341-8cfd21c009d2':(columnOrder:!(b15bf0fc-2be4-44ee-a172-6e4413dc67cf,'833bebe3-1a9b-4a7e-bd81-7162e2fc0c10',be06f723-1423-4972-b955-8b221713c302),columns:('833bebe3-1a9b-4a7e-bd81-7162e2fc0c10':(dataType:date,isBucketed:!t,label:'Created%20Date',operationType:date_histogram,params:(includeEmptyRows:!t,interval:auto),scale:interval,sourceField:'Created%20Date'),b15bf0fc-2be4-44ee-a172-6e4413dc67cf:(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Borough',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:be06f723-1423-4972-b955-8b221713c302,type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:Borough),be06f723-1423-4972-b955-8b221713c302:(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!(be06f723-1423-4972-b955-8b221713c302),layerId:'7c3aa603-f31f-4824-b341-8cfd21c009d2',layerType:data,seriesType:area_percentage_stacked,splitAccessor:b15bf0fc-2be4-44ee-a172-6e4413dc67cf,xAccessor:'833bebe3-1a9b-4a7e-bd81-7162e2fc0c10')),legend:(isVisible:!t,legendSize:auto,position:right),preferredSeriesType:area_percentage_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:8,i:'3f1be536-8220-4204-874f-db1498034f12',w:19,x:29,y:0),panelIndex:'3f1be536-8220-4204-874f-db1498034f12',title:'%25%20calls%20per%20borough',type:lens,version:'8.5.0'),(embeddableConfig:(enhancements:(),hiddenLayers:!(),isLayerTOCOpen:!t,mapBuffer:(maxLat:41.24477,maxLon:-73.47656,minLat:40.44695,minLon:-74.17969),mapCenter:(lat:40.74794,lon:-73.87799,zoom:9.83),openTOCDetails:!('2ff8bb36-3945-43ce-a1ec-c98f54a3b298','230f84f9-77af-43d9-8712-e8feff6e2468')),gridData:(h:30,i:'65512498-1584-45a3-b45c-256acde35217',w:18,x:0,y:8),id:'32dcf680-8e5c-11ec-ae6b-fd283f38af31',panelIndex:'65512498-1584-45a3-b45c-256acde35217',type:map,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-8706c7a4-5c0d-4710-a9e0-eb1376f94dcb,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:('8706c7a4-5c0d-4710-a9e0-eb1376f94dcb':(columnOrder:!('328e6658-99e9-4ec4-9673-8c2f1ab422d4','55e4f4ab-de64-43ec-abef-321b06df56d9','88e25f4b-282a-419f-8ad9-ab5fb684fc6c'),columns:('328e6658-99e9-4ec4-9673-8c2f1ab422d4':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Location%20Type',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'88e25f4b-282a-419f-8ad9-ab5fb684fc6c',type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:'Location%20Type'),'55e4f4ab-de64-43ec-abef-321b06df56d9':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Borough',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:'88e25f4b-282a-419f-8ad9-ab5fb684fc6c',type:column),orderDirection:desc,otherBucket:!t,size:7),scale:ordinal,sourceField:Borough),'88e25f4b-282a-419f-8ad9-ab5fb684fc6c':(dataType:number,isBucketed:!f,label:'Count%20of%20records',operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(axisTitlesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),fittingFunction:None,gridlinesVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),layers:!((accessors:!('88e25f4b-282a-419f-8ad9-ab5fb684fc6c'),layerId:'8706c7a4-5c0d-4710-a9e0-eb1376f94dcb',layerType:data,position:top,seriesType:bar_horizontal_stacked,showGridlines:!f,splitAccessor:'55e4f4ab-de64-43ec-abef-321b06df56d9',xAccessor:'328e6658-99e9-4ec4-9673-8c2f1ab422d4')),legend:(isVisible:!t,legendSize:auto,position:top),preferredSeriesType:bar_horizontal_stacked,tickLabelsVisibilitySettings:(x:!t,yLeft:!t,yRight:!t),valueLabels:hide,yLeftExtent:(mode:full),yRightExtent:(mode:full))),title:'',type:lens,visualizationType:lnsXY),enhancements:(),hidePanelTitles:!f),gridData:(h:30,i:'14fa2575-2646-4468-b0b6-55f6fddc7ad9',w:16,x:18,y:8),panelIndex:'14fa2575-2646-4468-b0b6-55f6fddc7ad9',title:'Location%20type%20and%20Boroughs',type:lens,version:'8.5.0'),(embeddableConfig:(attributes:(references:!((id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-current-indexpattern,type:index-pattern),(id:c66f1746-1a4e-4c14-9df4-1bc417d856a9,name:indexpattern-datasource-layer-fb644217-211d-4215-82ac-080f2fb87f22,type:index-pattern)),state:(datasourceStates:(indexpattern:(layers:(fb644217-211d-4215-82ac-080f2fb87f22:(columnOrder:!('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77',f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e),columns:('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77':(dataType:string,isBucketed:!t,label:'Top%20values%20of%20Agency%20Name',operationType:terms,params:(missingBucket:!f,orderBy:(columnId:f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e,type:column),orderDirection:desc,otherBucket:!t,size:15),scale:ordinal,sourceField:'Agency%20Name'),f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e:(customLabel:!t,dataType:number,isBucketed:!f,label:Calls,operationType:count,scale:ratio,sourceField: ___records___ )),incompleteColumns:())))),filters:!(),query:(language:kuery,query:''),visualization:(layers:!((categoryDisplay:default,layerId:fb644217-211d-4215-82ac-080f2fb87f22,layerType:data,legendDisplay:default,legendSize:auto,metric:f7e4c0f8-1b1c-4c8a-b02b-7a35db8eb91e,nestedLegend:!f,numberDisplay:percent,primaryGroups:!('7dd8d7a4-913c-4b8d-bce6-c878f8a69e77'))),shape:treemap)),title:'',type:lens,visualizationType:lnsPie),enhancements:(),hidePanelTitles:!f),gridData:(h:30,i:'39eabf4e-2341-43b8-97f6-a9de5886e94a',w:14,x:34,y:8),panelIndex:'39eabf4e-2341-43b8-97f6-a9de5886e94a',title:Agencies,type:lens,version:'8.5.0')),query:(language:kuery,query:''),tags:!('491469a0-8e5d-11ec-ae6b-fd283f38af31','7bf77380-8e5d-11ec-ae6b-fd283f38af31'),timeRange:(from:'2018-12-31T23:00:00.000Z',to:'2020-12-31T23:00:00.000Z'),timeRestore:!t,title:'%F0%9F%97%BD%20NYC%20311%20%F0%9F%97%BD',viewMode:view)).

Hope it helps!

---

<div class="post-metadata">

**Author:** ![Shashank02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shashank02/32/99866_2.png) [@Shashank02](https://discuss.elastic.co/u/Shashank02)\
**Post date:** [December 30, 2022, 4:41pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/5 "2022-12-30T16:41:59Z")

</div>

I've got this code. If it's possible can you please check and tell me that it is correct? I've also put in the id of my dashboard.

```auto
const axios = require('axios');

async function updateFilters() {
  try {
    const response = await axios.post(
      '/api/kibana/dashboards/e1af0b80-8285-11ed-8b1c-73fa260fa999/_update_filter',
      {
        // replace e1af0b80-8285-11ed-8b1c-73fa260fa999 with the ID of the dashboard
        filters: [
          {
            query: {
              match_phrase: {
                event: 'lionelmessi'
              }
            }
          }
        ]
      },
      {
        headers: {
          // replace YOUR_API_KEY with your API key
          'kbn-xsrf': 'API_KEY'
        }
      }
    );
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
}

updateFilters();

```

---

<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 27, 2023, 4:42pm UTC](https://discuss.elastic.co/t/need-to-apply-filter-to-kibana-dashboard-automatically-through-html/322122/6 "2023-01-27T16:42:50Z")

</div>

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