Home > kibana-plugin-core-server > SavedObjectsServiceSetup
Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for registering Saved Object types, creating and registering Saved Object client wrappers and factories.
Signature:
export interface SavedObjectsServiceSetup
When plugins access the Saved Objects client, a new client is created using the factory provided to setClientFactory
and wrapped by all wrappers registered through addClientWrapper
.
All the setup APIs will throw if called after the service has started, and therefor cannot be used from legacy plugin code. Legacy plugins should use the legacy savedObject service until migrated.
import { SavedObjectsClient, CoreSetup } from 'src/core/server';
export class Plugin() {
setup: (core: CoreSetup) => {
core.savedObjects.setClientFactory(({ request: KibanaRequest }) => {
return new SavedObjectsClient(core.savedObjects.scopedRepository(request));
})
}
}
import { SavedObjectsClient, CoreSetup } from 'src/core/server';
import { mySoType } from './saved_objects'
export class Plugin() {
setup: (core: CoreSetup) => {
core.savedObjects.registerType(mySoType);
}
}
Property | Type | Description |
---|---|---|
addClientWrapper | (priority: number, id: string, factory: SavedObjectsClientWrapperFactory) => void |
Add a client wrapper factory with the given priority. |
getImportExportObjectLimit | () => number |
Returns the maximum number of objects allowed for import or export operations. |
registerType | (type: SavedObjectsType) => void |
Register a savedObjects type definition.See the mappings format and migration format for more details about these. |
setClientFactoryProvider | (clientFactoryProvider: SavedObjectsClientFactoryProvider) => void |
Set the default factory provider for creating Saved Objects clients. Only one provider can be set, subsequent calls to this method will fail. |