Kibana 7.7: Get associated saved search for visualization plugin

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.

It isn't passed on visData.savedSearchId?

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.

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.

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.