Getting saved searches (objects) for plugin use

Hi, I'm new to kibana and i'm trying to experiment with its plugins.

I want to get the saved searches (Objects) to use in my plugin. e.g. If i saved a search named "nameSearch" with the search content as "nabeel*" . I would like to get this "nameSearch" and the search pattern "nabeel*" in my plugin.

How can I achieve this? Any guidance in this regard is appreciated.

SavedObjectRegistry would be one way to do that ... for example to get all saved visualizations:

import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
 
app.controller('TestVisApp', function ($scope, Private, AppState) {
  const services = Private(SavedObjectRegistryProvider).byLoaderPropertiesName;
  const visualizationService = services.visualizations;
 
  visualizationService.find().then(result => { $scope.savedVisualizations = result.hits; });
});

Thanks, @ppisljar for your reply.
Actually I need to get all the saved Searches not visualizations. Can u point me in the right direction or documnetation where i can find the properties of searches instead of visualizations?

unfortunately there is no documentation around this and the only way to approach it would be to start reading the code, inspecting the variables and figuring out what to do. Probably it would be best to check how this is implemented in management for example, where all the saved objects are listed.

take a look at the following file: https://github.com/elastic/kibana/blob/master/src/ui/public/saved_objects/find_object_by_title.js

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