# Getting access to filterManager in Kibana 7.8

**URL:** <https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722>\
**Category:** Kibana\
**Created:** [August 12, 2020, 1:24pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722 "2020-08-12T13:24:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [August 12, 2020, 1:24pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/1 "2020-08-12T13:24:29Z")

</div>

I wrote a plugin for Kibana 7.5 and I'm porting it to Kibana 7.8. I need access to the filterManager from within my visualization file. Is there an example of how to do this in Kibana 7.8? In 7.5 I was able to do the following:

```auto
import { start as data } from "../../../../src/legacy/core_plugins/data/public/legacy";

```

and then

```auto
this.filterManager = data.filter.filterManager;
this.filterWatcher = this.filterManager.getUpdates$().subscribe(this.inheritFilters.bind(this));

```

From my research, I think I need to import DataPublicPluginSetup to get access to the filterManager, but when I import that value, it is always "undefined". Is there a example somewhere of how to access the filterManager in Kibana 7.8?

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [August 12, 2020, 1:50pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/2 "2020-08-12T13:50:56Z")

</div>

Are you attempting to migrate to the Kibana platform when doing this? If you have a `kibana.json` file, then that's the case and you need to pass the filter manager instance down from the `setup` method of your plugin class.

---

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [August 12, 2020, 2:07pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/3 "2020-08-12T14:07:23Z")

</div>

Yes. I've created a basic 7.8 plugin and now I'm trying to add my code from my 7.5 plugin into the 7.8 plugin. We are in the process of moving from 7.5 to 7.8. So I do have a `kibana.json` file. After posting this question, I did find that I'll have to add `"data"` to my `requiredPlugins` section of the `kibana.json` file to get access to `DataPublicPluginSetup`. Things like that is what I need to know because that is total different than how it was setup in 7.5. Can you point me to an example of how to pass that information on from my `setup` method? Here's my current `setup` method:

```auto
public setup(core: CoreSetup, setupDeps: SetupDependencies) {
      setupDeps.visualizations.createReactVisualization({
         name: PLUGIN_NAME,
         title: PLUGIN_TITLE,
         icon: visIcon,
         description: 'My Plugin',
         visConfig: {
            component: Visualization,
            defaults: {
            }
         },
         editorConfig: {
            optionsTemplate: Editor,
         },
         requestHandler: defaultRequestHandler,
         responseHandler: defaultResponseHandler
      });
   }

```

Where my Visualization and Editor components are loaded like this:

```auto
import Visualization from './components/visualization';
import Editor from './components/editor';

```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [August 12, 2020, 3:33pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/4 "2020-08-12T15:33:06Z")

</div>

I see, it's a little more tricky in that case. You can store the reference to data passed into your setup/start methods in a module your import from in your actual visualization.

Check out how the reference to the format service is passed down in the metric visualization:

- setting the reference: [https://github.com/elastic/kibana/blob/master/src/plugins/vis\_type\_metric/public/plugin.ts#L60](https://github.com/elastic/kibana/blob/master/src/plugins/vis_type_metric/public/plugin.ts#L60)
- using the reference: [https://github.com/elastic/kibana/blob/master/src/plugins/vis\_type\_metric/public/components/metric\_vis\_component.tsx#L125](https://github.com/elastic/kibana/blob/master/src/plugins/vis_type_metric/public/components/metric_vis_component.tsx#L125)
- How the reference is managed: [https://github.com/elastic/kibana/blob/master/src/plugins/vis\_type\_metric/public/services.ts#L23](https://github.com/elastic/kibana/blob/master/src/plugins/vis_type_metric/public/services.ts#L23)

You can do the exact same thing with the field formatter

---

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [August 12, 2020, 3:44pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/5 "2020-08-12T15:44:32Z")

</div>

Thank you! Those examples help a lot.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [August 12, 2020, 3:45pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/6 "2020-08-12T15:45:46Z")

</div>

7.8 is a hard target for plugin development because a lot of things are in flux due to the migration to Kibana platform. Putting together better documentation and other material to write plugins is an important task on the roadmap/

---

<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:** [September 9, 2020, 3:46pm UTC](https://discuss.elastic.co/t/getting-access-to-filtermanager-in-kibana-7-8/244722/7 "2020-09-09T15:46:24Z")

</div>

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