# Find/Intercept query from visualization plugin

**URL:** <https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053>\
**Category:** Kibana\
**Created:** [June 2, 2017, 9:46am UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053 "2017-06-02T09:46:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![voiser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voiser/32/18739_2.png) [@voiser](https://discuss.elastic.co/u/voiser)\
**Post date:** [June 2, 2017, 9:46am UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/1 "2017-06-02T09:46:44Z")

</div>

Hi all,

I am learning a little bit about Kibana 5.x and as an exercise I am creating some visualizations. To the date I have had some success playing with filters and aggregations, and now I am trying to make an 'inspector' visualization which does something like the spy\_mode.

I have created a new 'spy' to intercept the request and response, and it works fine except for the fact that it runs only when the spy panel is shown.

So my question is: how can a visualization plugin obtain the request object? Is there any 'event' I can watch to, or an UI module that I can use to get it?

Thank you very much for your help and the amazing Kibana!

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [June 2, 2017, 12:14pm UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/2 "2017-06-02T12:14:57Z")

</div>

I think searchSource should be available on scope, which holds all that info (request, response, ... ). You can try looking there and see if it helps you.

---

<div class="post-metadata">

**Author:** ![voiser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voiser/32/18739_2.png) [@voiser](https://discuss.elastic.co/u/voiser)\
**Post date:** [June 2, 2017, 12:45pm UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/3 "2017-06-02T12:45:18Z")

</div>

Hi Marius,

Thank you for your help. Unfortunately, I am not able to find any searchSource in the visualization scope.

I'll investigate on that in the core plugins. Any help would be much appreciated.

Thanks,

David

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [June 2, 2017, 12:46pm UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/4 "2017-06-02T12:46:52Z")

</div>

Could you try in $scope.$parent.savedSearch then? Should be somewhere around here.  
Otherwise, check the existing spy modes `core_plugins/spy_modes`

---

<div class="post-metadata">

**Author:** ![voiser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/voiser/32/18739_2.png) [@voiser](https://discuss.elastic.co/u/voiser)\
**Post date:** [June 5, 2017, 7:11am UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/5 "2017-06-05T07:11:07Z")

</div>

No luck ☹

I can't find a reference to the searchSource anywhere in a basic visualization plugin. I guess it can be injected somehow.

I'll keep investigating, if I find it I will post it here for future reference, it seems that this is a quite recurrent question.

Cheers,

David

---

<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 3, 2017, 7:11am UTC](https://discuss.elastic.co/t/find-intercept-query-from-visualization-plugin/88053/6 "2017-07-03T07:11:19Z")

</div>

Closed on July 3, 2017, 7:11am UTC

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