src/platform/plugins/shared/esql/README.md
The editor accepts the following properties:
{esql: from index1 | limit 10})Error.
To use it on your application, you need to add the textBasedLanguages to your requiredBundles and the @kbn/esql to your tsconfig.json and use the component like that:
import { ESQLLangEditor } from '@kbn/esql/public';
<ESQLLangEditor
query={query}
onTextLangQueryChange={onTextLangQueryChange}
errors={props.textBasedLanguageModeErrors}
isDisabled={false}
onTextLangQuerySubmit={onTextLangQuerySubmit}
/>
The ESQLEditor is currently part of the unified search component. If your application uses the dataview picker then it can be enabled by adding
textBasedLanguages: ['ESQL'],
om the dataViewPickerProps property.
It is also part of the:
The esql plugin exposes a setup contract (EsqlPluginSetup) that other plugins can use during their own setup lifecycle.
registerSourceEnricher(enricher)Register a function to enrich the list of ES|QL source autocomplete suggestions. Multiple plugins may register enrichers; they are chained in registration order.
Signature:
registerSourceEnricher(
enricher: (sources: ESQLSourceResult[]) => Promise<ESQLSourceResult[]>
): void;
The enricher receives the current list of ESQLSourceResult objects and must return a (potentially modified) list. Each result can be augmented with:
title – display label (overrides name in the suggestion list)description – markdown text shown in the autocomplete detail popuplinks – array of { label, url } shown as links in the detail popuptype – one of SOURCES_TYPES.* (e.g. WIRED_STREAM, CLASSIC_STREAM) for visual differentiationExample (plugin setup):
setup(core, { esql }) {
esql?.registerSourceEnricher(async (sources) => {
return sources.map((source) => ({
...source,
description: 'Custom description for ' + source.name,
}));
});
}
Add esql to your plugin's optionalPlugins list in kibana.jsonc and declare esql?: EsqlPluginSetup in your setup dependencies type.
Follow this guide.