# Kibana 7.7: Get associated saved search for visualization plugin

**URL:** <https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932>\
**Category:** Kibana\
**Created:** [September 8, 2020, 11:41pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932 "2020-09-08T23:41:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdd1](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@jdd1](https://discuss.elastic.co/u/jdd1)\
**Post date:** [September 8, 2020, 11:41pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/1 "2020-09-08T23:41:18Z")

</div>

I have built a custom ReactJS visualization plugin, in which I use a custom request handler. Since I have requiresSearch set to true, I am able to choose an index pattern or saved search as the data source, and I am able to get the data with no problem. If there is an associated saved search, is there a way to get that saved search? The saved search ID? Even the visualization's ID, so that the saved search could be read from ElasticSearch?

The index pattern comes in as props.visData.index, but I can't seem to find the saved search in anything passed to the React Component.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [September 10, 2020, 7:36pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/2 "2020-09-10T19:36:26Z")

</div>

It isn't passed on visData.savedSearchId?

---

<div class="post-metadata">

**Author:** ![jdd1](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@jdd1](https://discuss.elastic.co/u/jdd1)\
**Post date:** [September 10, 2020, 8:15pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/3 "2020-09-10T20:15:03Z")

</div>

It does not appear to be. As I understand it, the request handler returns what becomes "visData." The following fields are passed to the request handler: filters, forceFetch, index, inspectorAdapters, metricsAtAlllevels, partialRows, query, queryFilter, timeRange, uiState, and visParams. None of those have savedSearchId or appear to have anything referring to it. I can get the index pattern from "index," but I can't find a way to get the saved search.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [September 10, 2020, 11:13pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/4 "2020-09-10T23:13:44Z")

</div>

I'm not sure what the exact method is, I think you will need to read through some of the source code in 7.7.0 to find out how existing visualizations are provided with `savedSearchId`. It's definitely available, but maybe the location of the parameter isn't what you expected.

---

<div class="post-metadata">

**Author:** ![jdd1](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@jdd1](https://discuss.elastic.co/u/jdd1)\
**Post date:** [September 10, 2020, 11:30pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/5 "2020-09-10T23:30:27Z")

</div>

Can you suggest a visualization to check? Between looking at the properties passed to the Component constructor and scanning some of the source code, I haven't been able to find the parameter (or any obvious form of it). It seems like the parameter might exist in some parent of the visualization's React Component, but it doesn't seem to get passed down. Unlike AngularJS, I can't (that I know of) just climb the parent $scopes to track it down. My lack of success is what led me to finally post on the forum.

---

<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:** [October 8, 2020, 11:30pm UTC](https://discuss.elastic.co/t/kibana-7-7-get-associated-saved-search-for-visualization-plugin/247932/6 "2020-10-08T23:30:29Z")

</div>

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