kibana/x-pack/plugins/global_search
Christiane (Tina) Heiligers 4e1b4c299c
Core to SharedOX ownership Transfer: Updates code owners for handover to sharedUX (#151213)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-15 11:33:39 -07:00
..
common fix all violations 2022-04-16 01:37:30 -05:00
public chore(NA): upgrades uuid to v9.0.0 (#149135) 2023-01-19 19:48:07 +00:00
server Migrates core test_utils to package (#143483) 2022-10-18 12:26:11 -07:00
jest.config.js [jest] update config files to get coverage per plugin (#111299) 2021-09-09 08:14:56 +02:00
jest.integration.config.js [ci] Splits Jest integration tests (#125454) 2022-02-14 17:12:42 +01:00
kibana.jsonc Core to SharedOX ownership Transfer: Updates code owners for handover to sharedUX (#151213) 2023-02-15 11:33:39 -07:00
README.md
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

Kibana GlobalSearch plugin

The GlobalSearch plugin provides an easy way to search for various objects, such as applications or dashboards from the Kibana instance, from both server and client-side plugins

Consuming the globalSearch API

startDeps.globalSearch.find('some term').subscribe({
  next: ({ results }) => {
    addNewResultsToList(results);
  },
  error: () => {},
  complete: () => {
    showAsyncSearchIndicator(false);
  }
});

Registering custom result providers

The GlobalSearch API allows to extend provided results by registering your own provider.

setupDeps.globalSearch.registerResultProvider({
  id: 'my_provider',
  find: (term, options, context) => {
    const resultPromise = myService.search(term, context.core.savedObjects.client);
    return from(resultPromise).pipe(takeUntil(options.aborted$);
  },
});

Known limitations

Client-side registered providers

Results from providers registered from the client-side registerResultProvider API will not be available when performing a search from the server-side. For this reason, prefer registering providers using the server-side API when possible.

Refer to the RFC for more details

Search completion cause

There is currently no way to identify globalSearch.find observable completion cause: searches completing because all providers returned all their results and searches completing because the consumer aborted the search using the aborted$ option or because the internal timout period has been reaches will both complete the same way.