kibana/docs/development/core/public/kibana-plugin-public.savedobjectsclient.md
Rudolf Meijering f7a71f2035
[Core] Make type option required for SavedObjects.find (#42236)
* Make type option required for SavedObjects.find

* getSortedObjectsForExport test for type or objects
2019-08-12 16:33:35 +02:00

2.8 KiB

Home > kibana-plugin-public > SavedObjectsClient

SavedObjectsClient class

Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state. The client-side SavedObjectsClient is a thin convenience library around the SavedObjects HTTP API for interacting with Saved Objects.

Signature:

export declare class SavedObjectsClient 

Properties

Property Modifiers Type Description
bulkCreate (objects?: SavedObjectsBulkCreateObject<SavedObjectAttributes>[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<SavedObjectAttributes>> Creates multiple documents at once
bulkGet (objects?: {
id: string;
type: string;
}[]) => Promise<SavedObjectsBatchResponse<SavedObjectAttributes>>
Returns an array of objects by id
create <T extends SavedObjectAttributes>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>> Persists an object
delete (type: string, id: string) => Promise<{}> Deletes an object
find <T extends SavedObjectAttributes>(options: Pick<SavedObjectFindOptionsServer, "search" | "type" | "defaultSearchOperator" | "searchFields" | "sortField" | "hasReference" | "page" | "perPage" | "fields">) => Promise<SavedObjectsFindResponsePublic<T>> Search for objects
get <T extends SavedObjectAttributes>(type: string, id: string) => Promise<SimpleSavedObject<T>> Fetches a single object

Methods

Method Modifiers Description
update(type, id, attributes, { version, migrationVersion, references }) Updates an object

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the SavedObjectsClient class.