src/platform/packages/private/kbn-index-editor/README.md
This package provides a comprehensive UI for creating and editing lookup indexes through an interactive flyout interface.
Depending on how the flyout is opened:
Actions are gated by:
view_index_metadata (view).import { registerIndexEditorActions, EDIT_LOOKUP_INDEX_CONTENT_TRIGGER } from '@kbn/index-editor';
import type { EditLookupIndexFlyoutDeps } from '@kbn/index-editor';
// Register the index editor telemetry events inside setup
registerIndexEditorAnalyticsEvents(core.analytics);
// Register the index editor actions with required dependencies
const deps: EditLookupIndexFlyoutDeps = {
coreStart,
data,
uiActions,
fieldFormats,
share,
fileUpload,
};
registerIndexEditorActions(deps);
import { EDIT_LOOKUP_INDEX_CONTENT_TRIGGER_ID, ACTION_EDIT_LOOKUP_INDEX } from '@kbn/index-editor';
import type { EditLookupIndexContentContext } from '@kbn/index-editor';
// Create context for the index editor
const context: EditLookupIndexContentContext = {
indexName: 'my-lookup-index',
doesIndexExist: true,
canEditIndex: true,
triggerSource: 'your_source', // Used only for telemetry
onClose: (result) => {
console.log('Index editor closed:', result);
},
};
// Trigger the index editor flyout
await uiActions.executeTriggerActions('EDIT_LOOKUP_INDEX_CONTENT_TRIGGER_ID', context);
The invocations is the same, but you have to set doesIndexExist to false.
You can provide or not an indexName, if provided it will prefill the index name input with it.