Opensearch dashboards
opensearch-dashboards package
The OpenSearch Dashboards Core APIs for server-side plugins.
A plugin requires a opensearch_dashboards.json
file at it's root directory that follows the manfiest schema to define static plugin information required to load the plugin.
A plugin's server/index
file must contain a named import, plugin
, that implements PluginInitializer which returns an object that implements .
The plugin integrates with the core system via lifecycle events: setup
, start
, and stop
. In each lifecycle method, the plugin will receive the corresponding core services available (either CoreSetup or CoreStart) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked.
Classes
Class | Description |
---|---|
BasePath | Access or manipulate the OpenSearch Dashboards base path |
CspConfig | CSP configuration for use in OpenSearch Dashboards. |
LegacyClusterClient | Represents an OpenSearch cluster API client created by the platform. It allows to call API on behalf of the internal OpenSearch Dashboards user and the actual user that is derived from the request headers (via asScoped(...) ). |
LegacyOpenSearchErrorHelpers | Helpers for working with errors returned from the OpenSearch service.Since the internal data of errors are subject to change, consumers of the OpenSearch service should always use these helpers to classify errors instead of checking error internals such as body.error.header[WWW-Authenticate] |
LegacyScopedClusterClient | Serves the same purpose as the normal cluster client but exposes an additional asCurrentUser method that doesn't use credentials of the OpenSearch Dashboards internal user (as asInternalUser does) to request OpenSearch API, but rather passes HTTP headers extracted from the current user request to the API instead. |
OpenSearchConfig | Wrapper of config schema. |
OpenSearchDashboardsRequest | OpenSearch Dashboards specific abstraction for an incoming request. |
RouteValidationError | Error to return when the validation is not successful. |
SavedObjectsClient | |
SavedObjectsErrorHelpers | |
SavedObjectsRepository | |
SavedObjectsSerializer | A serializer that can be used to manually convert raw or sanitized documents to the other kind. |
SavedObjectsUtils | |
SavedObjectTypeRegistry | Registry holding information about all the registered saved object types. |
Enumerations
Enumeration | Description |
---|---|
AuthResultType | |
AuthStatus | Status indicating an outcome of the authentication. |
Functions
Function | Description |
---|---|
exportSavedObjectsToStream({ types, objects, search, savedObjectsClient, exportSizeLimit, includeReferencesDeep, excludeExportDetails, namespace, }) | Generates sorted saved object stream to be used for export. See the options for more detailed information. |
importSavedObjectsFromStream({ readStream, objectLimit, overwrite, createNewCopies, savedObjectsClient, typeRegistry, namespace, }) | Import saved objects from given stream. See the options for more detailed information. |
resolveSavedObjectsImportErrors({ readStream, objectLimit, retries, savedObjectsClient, typeRegistry, namespace, createNewCopies, }) | Resolve and return saved object import errors. See the options for more detailed informations. |
Interfaces
Interface | Description |
---|---|
AppCategory | A category definition for nav links to know where to sort them in the left hand nav |
AssistanceAPIResponse | |
AssistantAPIClientParams | |
AuditableEvent | Event to audit. |
Auditor | Provides methods to log user actions and access events. |
AuditorFactory | Creates Auditor instance bound to the current user credentials. |
AuditTrailSetup | |
Authenticated | |
AuthNotHandled | |
AuthRedirected | |
AuthRedirectedParams | Result of auth redirection. |
AuthResultParams | Result of successful authentication. |
AuthToolkit | A tool set defining an outcome of Auth interceptor for incoming request. |
Capabilities | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. |
CapabilitiesSetup | APIs to manage the Capabilities that will be used by the application.Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the registerProvider method.Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the registerSwitcher method.Refers to the methods documentation for complete description and examples. |
CapabilitiesStart | APIs to access the application Capabilities. |
ContextSetup | An object that handles registration of context providers and configuring handlers with context. |
CoreSetup | Context passed to the plugins setup method. |
CoreStart | Context passed to the plugins start method. |
CoreStatus | Status of core services. |
CountResponse | |
CustomHttpResponseOptions | HTTP response parameters for a response with adjustable status code. |
DeleteDocumentResponse | |
DeprecationAPIClientParams | |
DeprecationAPIResponse | |
DeprecationInfo | |
DeprecationSettings | UiSettings deprecation field options. |
DiscoveredPlugin | Small container object used to expose information about discovered plugins that may or may not have been started. |
ErrorHttpResponseOptions | HTTP response parameters |
Explanation | |
FakeRequest | Fake request object created manually by OpenSearch Dashboards plugins. |
GetResponse | |
HttpAuth | |
HttpResources | HttpResources service is responsible for serving static & dynamic assets for OpenSearch Dashboards application via HTTP. Provides API allowing plug-ins to respond with: - a pre-configured HTML page bootstrapping OpenSearch Dashboards client app - custom HTML page - custom JS script file. |
HttpResourcesRenderOptions | Allows to configure HTTP response parameters |
HttpResourcesServiceToolkit | Extended set of OpenSearchDashboardsResponseFactory helpers used to respond with HTML or JS resource. |
HttpResponseOptions | HTTP response parameters |
HttpServerInfo | |
HttpServiceSetup | OpenSearch Dashboards HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to hapi server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. |
HttpServiceStart | |
IClusterClient | Represents an OpenSearch cluster API client created by the platform. It allows to call API on behalf of the internal OpenSearch Dashboards user and the actual user that is derived from the request headers (via asScoped(...) ). |
IContextContainer | An object that handles registration of context providers and configuring handlers with context. |
ICspConfig | CSP configuration for use in OpenSearch Dashboards. |
ICustomClusterClient | See IClusterClient |
ImageValidation | |
IndexSettingsDeprecationInfo | |
IOpenSearchDashboardsResponse | A response data object, expected to returned as a result of RequestHandler execution |
IOpenSearchDashboardsSocket | A tiny abstraction for TCP socket. |
IRenderOptions | |
IRouter | Registers route handlers for specified resource path and method. See RouteConfig and RequestHandler for more information about arguments to route registrations. |
IScopedClusterClient | Serves the same purpose as the normal cluster client but exposes an additional asCurrentUser method that doesn't use credentials of the OpenSearch Dashboards internal user (as asInternalUser does) to request OpenSearch API, but rather passes HTTP headers extracted from the current user request to the API instead. |
IUiSettingsClient | Server-side client that provides access to the advanced settings stored in opensearch. The settings provide control over the behavior of the OpenSearch Dashboards application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. |
LegacyAPICaller | |
LegacyCallAPIOptions | The set of options that defines how API call should be made and result be processed. |
LegacyOpenSearchError | @deprecated. The new opensearch client doesn't wrap errors anymore. |
LegacyRequest | |
LegacyServiceSetupDeps | |
LegacyServiceStartDeps | |
LoggerContextConfigInput | |
LoggingServiceSetup | Provides APIs to plugins for customizing the plugin's logger. |
MetricsServiceSetup | APIs to retrieves metrics gathered and exposed by the core platform. |
NodesVersionCompatibility | |
OnPostAuthToolkit | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
OnPreAuthToolkit | A tool set defining an outcome of OnPreAuth interceptor for incoming request. |
OnPreResponseExtensions | Additional data to extend a response. |
OnPreResponseInfo | Response status code. |
OnPreResponseRender | Additional data to extend a response when rendering a new body |
OnPreResponseToolkit | A tool set defining an outcome of OnPreResponse interceptor for incoming request. |
OnPreRoutingToolkit | A tool set defining an outcome of OnPreRouting interceptor for incoming request. |
OpenSearchDashboardsRequestEvents | Request events. |
OpenSearchDashboardsRequestRoute | Request specific route information exposed to a handler. |
OpenSearchServiceSetup | |
OpenSearchServiceStart | |
OpenSearchStatusMeta | |
OpsMetrics | Regroups metrics gathered by all the collectors. This contains metrics about the os/runtime, the OpenSearch Dashboards process and the http server. |
OpsOsMetrics | OS related metrics |
OpsProcessMetrics | Process related metrics |
OpsServerMetrics | server related metrics |
Plugin_2 | The interface that should be returned by a PluginInitializer . |
PluginConfigDescriptor | Describes a plugin configuration properties. |
PluginInitializerContext | Context that's available to plugins during initialization stage. |
PluginManifest | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. |
RequestHandlerContext | Plugin specific context passed to a route handler.Provides the following clients and services: - savedObjects.client - Saved Objects client which uses the credentials of the incoming request - savedObjects.typeRegistry - Type registry containing all the registered types. - opensearch.client - OpenSearch data client which uses the credentials of the incoming request - opensearch.legacy.client - The legacy OpenSearch data client which uses the credentials of the incoming request - uiSettings.client - uiSettings client which uses the credentials of the incoming request - uiSettings.auditor - AuditTrail client scoped to the incoming request |
RouteConfig | Route specific configuration. |
RouteConfigOptions | Additional route options. |
RouteConfigOptionsBody | Additional body options for a route |
RouteValidationResultFactory | Validation result factory to be used in the custom validation function to return the valid data or validation errorsSee RouteValidationFunction. |
RouteValidatorConfig | The configuration object to the RouteValidator class. Set params , query and/or body to specify the validation logic to follow for that property. |
RouteValidatorOptions | Additional options for the RouteValidator class to modify its default behaviour. |
SavedObject | |
SavedObjectAttributes | The data for a Saved Object is stored as an object in the attributes property. |
SavedObjectMigrationContext | Migration context provided when invoking a migration handler |
SavedObjectMigrationMap | A map of migration functions to be used for a given type. The map's keys must be valid semver versions.For a given document, only migrations with a higher version number than that of the document will be applied. Migrations are executed in order, starting from the lowest version and ending with the highest one. |
SavedObjectReference | A reference to another saved object. |
SavedObjectsAddToNamespacesOptions | |
SavedObjectsAddToNamespacesResponse | |
SavedObjectsBaseOptions | |
SavedObjectsBulkCreateObject | |
SavedObjectsBulkGetObject | |
SavedObjectsBulkResponse | |
SavedObjectsBulkUpdateObject | |
SavedObjectsBulkUpdateOptions | |
SavedObjectsBulkUpdateResponse | |
SavedObjectsCheckConflictsObject | |
SavedObjectsCheckConflictsResponse | |
SavedObjectsClientProviderOptions | Options to control the creation of the Saved Objects Client. |
SavedObjectsClientWrapperOptions | Options passed to each SavedObjectsClientWrapperFactory to aid in creating the wrapper instance. |
SavedObjectsCreateOptions | |
SavedObjectsDeleteByNamespaceOptions | |
SavedObjectsDeleteFromNamespacesOptions | |
SavedObjectsDeleteFromNamespacesResponse | |
SavedObjectsDeleteOptions | |
SavedObjectsExportOptions | Options controlling the export operation. |
SavedObjectsExportResultDetails | Structure of the export result details entry |
SavedObjectsFindOptions | |
SavedObjectsFindResponse | Return type of the Saved Objects find() method.*Note*: this type is different between the Public and Server Saved Objects clients. |
SavedObjectsFindResult | |
SavedObjectsImportAmbiguousConflictError | Represents a failure to import due to a conflict, which can be resolved in different ways with an overwrite. |
SavedObjectsImportConflictError | Represents a failure to import due to a conflict. |
SavedObjectsImportError | Represents a failure to import. |
SavedObjectsImportMissingReferencesError | Represents a failure to import due to missing references. |
SavedObjectsImportOptions | Options to control the import operation. |
SavedObjectsImportResponse | The response describing the result of an import. |
SavedObjectsImportRetry | Describes a retry operation for importing a saved object. |
SavedObjectsImportSuccess | Represents a successful import. |
SavedObjectsImportUnknownError | Represents a failure to import due to an unknown reason. |
SavedObjectsImportUnsupportedTypeError | Represents a failure to import due to having an unsupported saved object type. |
SavedObjectsIncrementCounterOptions | |
SavedObjectsMappingProperties | Describe the fields of a saved object type. |
SavedObjectsMigrationLogger | |
SavedObjectsMigrationVersion | Information about the migrations that have been applied to this SavedObject. When OpenSearch Dashboards starts up, OpenSearchDashboardsMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. |
SavedObjectsRawDoc | A raw document as represented directly in the saved object index. |
SavedObjectsRepositoryFactory | Factory provided when invoking a client factory provider See SavedObjectsServiceSetup.setClientFactoryProvider |
SavedObjectsResolveImportErrorsOptions | Options to control the "resolve import" operation. |
SavedObjectsServiceSetup | Saved Objects is OpenSearchDashboards's data persistence mechanism allowing plugins to use OpenSearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for registering Saved Object types, creating and registering Saved Object client wrappers and factories. |
SavedObjectsServiceStart | Saved Objects is OpenSearchDashboards's data persisentence mechanism allowing plugins to use OpenSearch for storing and querying state. The SavedObjectsServiceStart API provides a scoped Saved Objects client for interacting with Saved Objects. |
SavedObjectStatusMeta | Meta information about the SavedObjectService's status. Available to plugins via CoreSetup.status. |
SavedObjectsType | |
SavedObjectsTypeManagementDefinition | Configuration options for the type's management section. |
SavedObjectsTypeMappingDefinition | Describe a saved object type mapping. |
SavedObjectsUpdateOptions | |
SavedObjectsUpdateResponse | |
SearchResponse | |
ServiceStatus | The current status of a service at a point in time. |
SessionCookieValidationResult | Return type from a function to validate cookie contents. |
SessionStorage | Provides an interface to store and retrieve data across requests. |
SessionStorageCookieOptions | Configuration used to create HTTP session storage based on top of cookie mechanism. |
SessionStorageFactory | SessionStorage factory to bind one to an incoming request |
ShardsInfo | |
ShardsResponse | |
StatusServiceSetup | API for accessing status of Core and this plugin's dependencies as well as for customizing this plugin's status. |
StringValidationRegex | StringValidation with regex object |
StringValidationRegexString | StringValidation as regex string |
UiSettingsParams | UiSettings parameters defined by the plugins. |
UiSettingsServiceSetup | |
UiSettingsServiceStart | |
UserProvidedValues | Describes the values explicitly set by user. |
Variables
Variable | Description |
---|---|
opensearchDashboardsResponseFactory | Set of helpers used to create OpenSearchDashboardsResponse to form HTTP response on an incoming request. Should be returned as a result of RequestHandler execution. |
ServiceStatusLevels | The current "level" of availability of a service. |
validBodyOutput | The set of valid body.output |
Type Aliases
Type Alias | Description |
---|---|
AppenderConfigType | |
AuditTrailStart | |
AuthenticationHandler | See AuthToolkit. |
AuthHeaders | Auth Headers map |
AuthResult | |
CapabilitiesProvider | See CapabilitiesSetup |
CapabilitiesSwitcher | See CapabilitiesSetup |
DestructiveRouteMethod | Set of HTTP methods changing the state of the server. |
GetAuthHeaders | Get headers to authenticate a user against OpenSearch. |
GetAuthState | Gets authentication state for a request. Returned by auth interceptor. |
HandlerContextType | Extracts the type of the first argument of a HandlerFunction to represent the type of the context. |
HandlerFunction | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in IContextContainer |
HandlerParameters | Extracts the types of the additional arguments of a HandlerFunction, excluding the HandlerContextType. |
Headers_2 | Http request headers to read. |
HttpResourcesRequestHandler | Extended version of RequestHandler having access to HttpResourcesServiceToolkit to respond with HTML or JS resources. |
HttpResourcesResponseOptions | HTTP Resources response parameters |
HttpResponsePayload | Data send to the client as a response payload. |
IBasePath | Access or manipulate the OpenSearch Dashboards base pathBasePath |
IContextProvider | A function that returns a context value for a specific key of given context type. |
ILegacyClusterClient | Represents an OpenSearch cluster API client created by the platform. It allows to call API on behalf of the internal OpenSearch Dashboards user and the actual user that is derived from the request headers (via asScoped(...) ).See LegacyClusterClient. |
ILegacyCustomClusterClient | Represents an OpenSearch cluster API client created by a plugin. It allows to call API on behalf of the internal OpenSearch Dashboards user and the actual user that is derived from the request headers (via asScoped(...) ).See LegacyClusterClient. |
ILegacyScopedClusterClient | Serves the same purpose as "normal" ClusterClient but exposes additional callAsCurrentUser method that doesn't use credentials of the OpenSearch Dashboards internal user (as callAsInternalUser does) to request OpenSearch API, but rather passes HTTP headers extracted from the current user request to the API.See LegacyScopedClusterClient. |
IsAuthenticated | Returns authentication status for a request. |
ISavedObjectsRepository | See SavedObjectsRepository |
ISavedObjectTypeRegistry | See SavedObjectTypeRegistry for documentation. |
KnownHeaders | Set of well-known HTTP headers. |
LegacyOpenSearchClientConfig | |
LifecycleResponseFactory | Creates an object containing redirection or error response with error details, HTTP headers, and other data transmitted to the client. |
LoggerConfigType | |
MetricsServiceStart | APIs to retrieves metrics gathered and exposed by the core platform. |
MIGRATION_ASSISTANCE_INDEX_ACTION | |
MIGRATION_DEPRECATION_LEVEL | |
MutatingOperationRefreshSetting | OpenSearch Refresh setting for mutating operation |
OnPostAuthHandler | See OnPostAuthToolkit. |
OnPreAuthHandler | See OnPreAuthToolkit. |
OnPreResponseHandler | See OnPreRoutingToolkit. |
OnPreRoutingHandler | See OnPreRoutingToolkit. |
OpenSearchClient | Client used to query the opensearch cluster. |
OpenSearchClientConfig | Configuration options to be used to create a cluster client using the createClient API |
OpenSearchDashboardsRequestRouteOptions | Route options: If 'GET' or 'OPTIONS' method, body options won't be returned. |
OpenSearchDashboardsResponseFactory | Creates an object containing request response payload, HTTP headers, error details, and other data transmitted to the client. |
PluginConfigSchema | Dedicated type for plugin configuration schema. |
PluginInitializer | The plugin export at the root of a plugin's server directory should conform to this interface. |
PluginName | Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays that use it as a key or value more obvious. |
PluginOpaqueId | |
PublicUiSettingsParams | A sub-set of UiSettingsParams exposed to the client-side. |
RedirectResponseOptions | HTTP response parameters for redirection response |
RequestHandler | A function executed when route path matched requested resource path. Request handler is expected to return a result of one of OpenSearchDashboardsResponseFactory functions. |
RequestHandlerContextContainer | An object that handles registration of http request context providers. |
RequestHandlerContextProvider | Context provider for request handler. Extends request context object with provided functionality or data. |
RequestHandlerWrapper | Type-safe wrapper for RequestHandler function. |
ResponseError | Error message and optional data send to the client in case of error. |
ResponseErrorAttributes | Additional data to provide error details. |
ResponseHeaders | Http response headers to set. |
RouteContentType | The set of supported parseable Content-Types |
RouteMethod | The set of common HTTP methods supported by OpenSearch Dashboards routing. |
RouteRegistrar | Route handler common definition |
RouteValidationFunction | The custom validation function if @osd/config-schema is not a valid solution for your specific plugin requirements. |
RouteValidationSpec | Allowed property validation options: either @osd/config-schema validations or custom validation functionsSee RouteValidationFunction for custom validation. |
RouteValidatorFullConfig | Route validations config and options merged into one object |
SafeRouteMethod | Set of HTTP methods not changing the state of the server. |
SavedObjectAttribute | Type definition for a Saved Object attribute value |
SavedObjectAttributeSingle | Don't use this type, it's simply a helper type for SavedObjectAttribute |
SavedObjectMigrationFn | A migration function for a saved object type used to migrate it to a given version |
SavedObjectSanitizedDoc | Describes Saved Object documents that have passed through the migration framework and are guaranteed to have a references root property. |
SavedObjectsClientContract | Saved Objects is OpenSearchDashboards's data persisentence mechanism allowing plugins to use OpenSearch for storing plugin state.## SavedObjectsClient errorsSince the SavedObjectsClient has its hands in everything we are a little paranoid about the way we present errors back to to application code. Ideally, all errors will be either:1. Caused by bad implementation (ie. undefined is not a function) and as such unpredictable 2. An error that has been classified and decorated appropriately by the decorators in SavedObjectsErrorHelpersType 1 errors are inevitable, but since all expected/handle-able errors should be Type 2 the isXYZError() helpers exposed at SavedObjectsErrorHelpers should be used to understand and manage error responses from the SavedObjectsClient .Type 2 errors are decorated versions of the source error, so if the opensearch client threw an error it will be decorated based on its type. That means that rather than looking for error.body.error.type or doing substring checks on error.body.error.reason , just use the helpers to understand the meaning of the error:```js if (SavedObjectsErrorHelpers.isNotFoundError(error)) { // handle 404 }if (SavedObjectsErrorHelpers.isNotAuthorizedError(error)) { // 401 handling should be automatic, but in case you wanted to know }// always rethrow the error unless you handle it throw error; ```### 404s from missing indexFrom the perspective of application code and APIs the SavedObjectsClient is a black box that persists objects. One of the internal details that users have no control over is that we use an opensearch index for persistance and that index might be missing.At the time of writing we are in the process of transitioning away from the operating assumption that the SavedObjects index is always available. Part of this transition is handling errors resulting from an index missing. These used to trigger a 500 error in most cases, and in others cause 404s with different error messages.From my (Spencer) perspective, a 404 from the SavedObjectsApi is a 404; The object the request/call was targeting could not be found. This is why #14141 takes special care to ensure that 404 errors are generic and don't distinguish between index missing or document missing.See SavedObjectsClient See SavedObjectsErrorHelpers |
SavedObjectsClientFactory | Describes the factory used to create instances of the Saved Objects Client. |
SavedObjectsClientFactoryProvider | Provider to invoke to retrieve a SavedObjectsClientFactory. |
SavedObjectsClientWrapperFactory | Describes the factory used to create instances of Saved Objects Client Wrappers. |
SavedObjectsFieldMapping | Describe a saved object type mapping field. |
SavedObjectsNamespaceType | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: * single (default): this type of saved object is namespace-isolated, e.g., it exists in only one namespace. * multiple: this type of saved object is shareable, e.g., it can exist in one or more namespaces. * agnostic: this type of saved object is global. |
SavedObjectUnsanitizedDoc | Describes Saved Object documents from OpenSearch Dashboards < 7.0.0 which don't have a references root property defined. This type should only be used in migrations. |
ScopeableRequest | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.See OpenSearchDashboardsRequest. |
ServiceStatusLevel | A convenience type that represents the union of each value in ServiceStatusLevels. |
SharedGlobalConfig | |
StartServicesAccessor | Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed start . This should only be used inside handlers registered during setup that will only be executed after start lifecycle. |
StringValidation | Allows regex objects or a regex string |
UiSettingsType | UI element type to represent the settings. |