# Querying and filtering an embed visualization

**URL:** <https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719>\
**Category:** Kibana\
**Created:** [November 7, 2017, 4:15pm UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719 "2017-11-07T16:15:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![havidarou](https://avatars.discourse-cdn.com/v4/letter/h/3ec8ea/32.png) [@havidarou](https://discuss.elastic.co/u/havidarou)\
**Post date:** [November 7, 2017, 4:15pm UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/1 "2017-11-07T16:15:48Z")

</div>

Hi @thomasneirynck, @ppisljar

I'm building upon the code provided in the Developing Visualizations webinar.

I've successfully enabled the timepicker and my visualizations get properly updated.

Now I want to query and filter it.

How would I go about it?

P.S.: I'm not in editorMode.

Regards!

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [November 7, 2017, 10:49pm UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/2 "2017-11-07T22:49:10Z")

</div>

hi @havidarou,

do you want to send a filter to the filter-bar when you click on a part of your chart?

For that, you will have to use the filter event-handler.

For some sample code, you can dig around some of the existing visualizations in Kibana. For example, this is how we do it when clicking a tag on the tag-cloud:

> <https://github.com/thomasneirynck/kibana/blob/8cde5ef98e07eca275d3b8890deec43bba1f4d20/src/core_plugins/tagcloud/public/tag_cloud_controller.js#L14-L19>

This produces a filter for that particular term.

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [November 8, 2017, 7:36am UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/3 "2017-11-08T07:36:20Z")

</div>

i think he is talking about embedding visualizations in his app ?

currently the only way to do that is by loading the saved object on your own and adding filters/query to the `searchSource` and then calling `embedVisualizationWithSavedObject`.

there are plans to make this easier in the future.

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [November 8, 2017, 7:39am UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/4 "2017-11-08T07:39:23Z")

</div>

@thomasneirynck there is a nicer way to apply filters on click (check the webinar code) which doesn't require creating AggConfigResults

---

<div class="post-metadata">

**Author:** ![havidarou](https://avatars.discourse-cdn.com/v4/letter/h/3ec8ea/32.png) [@havidarou](https://discuss.elastic.co/u/havidarou)\
**Post date:** [November 8, 2017, 5:16pm UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/5 "2017-11-08T17:16:24Z")

</div>

@thomasneirynck @ppisljar Yes I mean an embedded visualization in the app plugin.

How can I do it with AggConfigResults?

Right now I can filter the visualizations using the timepicker and I've successfully used the kbn-top-nav with the query-bar directives in the plugin, and can filter using text queries.

I'm trying to use the filter-bar directive (I've had to import it, it isn't include using autoload/all) but no luck with it so far.

The plan is to use the filter-bar along the click thing with the visualizations.

Help! xD

Thanks!

---

<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:** [December 6, 2017, 5:30pm UTC](https://discuss.elastic.co/t/querying-and-filtering-an-embed-visualization/106719/6 "2017-12-06T17:30:33Z")

</div>

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