kibana/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md

2.5 KiB

Home > kibana-plugin-plugins-expressions-server > ExecutionContext

ExecutionContext interface

ExecutionContext is an object available to all functions during a single execution; it provides various methods to perform side-effects.

Signature:

export interface ExecutionContext<InspectorAdapters extends Adapters = Adapters> 

Properties

Property Type Description
abortSignal AbortSignal Adds ability to abort current execution.
getSavedObject <T extends SavedObjectAttributes = SavedObjectAttributes>(type: string, id: string) => Promise<SavedObject<T>> Allows to fetch saved objects from ElasticSearch. In browser getSavedObject function is provided automatically by the Expressions plugin. On the server the caller of the expression has to provide this context function. The reason is because on the browser we always know the user who tries to fetch a saved object, thus saved object client is scoped automatically to that user. However, on the server we can scope that saved object client to any user, or even not scope it at all and execute it as an "internal" user.
getSearchContext () => ExecutionContextSearch Get search context of the expression.
getSearchSessionId () => string | undefined Search context in which expression should operate.
inspectorAdapters InspectorAdapters Adapters for inspector plugin.
types Record<string, ExpressionType> A map of available expression types.
variables Record<string, unknown> Context variables that can be consumed using var and var_set functions.