Create an AI Index
https://{kibana_url}
- POST /api/context_engine/ai_index
- POST /s/{space_id}/api/context_engine/ai_index
Refer to Spaces for more information.
Creates an AI Index record attached to a data stream or index. Fails with a 409 if an AI Index with the same ID already exists.
Returns a 404 response when Context Engine is turned off in this space (contextEngine:enabled).
For more information, refer to the Context Engine documentation.
[Required authorization] Route required privileges: contextEngine:write.
Request
-
automationsobject · max: 100 · default: [] -
Automations associated with the AI Index. Defaults to an empty array when omitted.
-
descriptionstring · max: 2048 -
Human-readable description of the AI Index.
-
destobjectrequired -
The data stream or index that backs the AI Index.
-
typerequired -
The type of the backing store.
data_streamfor a data stream, orindexfor an index. -
Values:
data_streamindex -
valuestring · min: 1 · max: 1024required -
The data stream or index (e.g.
ai-index-ds-foo,ai-index-idx-foo) the AI Index is attached to. Must name a single data stream or index (no wildcards or comma-separated lists), matchtype, and start withai-index-ds-(fordata_stream) orai-index-idx-(forindex). The rest of the value must be a valid AI Index ID. System indices are not allowed. -
feedback_analysisobject -
The recurring feedback analysis, which reads agent signals and proposes improvement actions for the AI Index.
-
agent_idstring · max: 256 -
Agent Builder agent ID that runs this index’s feedback-loop analysis.
-
allowed_actions· max: 9 · default: [ "add_ki", "edit_ki", "remove_ki", "add_workflow", "edit_workflow", "remove_workflow", "add_source", "edit_source", "remove_source" ] -
Improvement actions the analysis may propose. An empty list is observe-only.
-
Values:
add_kiedit_kiremove_kiadd_workflowedit_workflowremove_workflowadd_sourceedit_sourceremove_source -
enabledbooleanrequired -
Desired state of the recurring analysis. The scheduler stays authoritative for whether it is actually running.
-
scheduleobject · default: { "interval": "24h" } -
When the analysis runs.
-
intervalstring · max: 16required -
How often to analyze, for example
1hor24h. At least 15 minutes. -
signal_filterstring · max: 4096 -
KQL narrowing which signals this index analyzes, for example
tags: query_error. -
signal_time_rangeanyOf · default: { "from": "now-30d", "type": "relative" } -
Which signals the analysis reads. A read filter only.
-
idstring · min: 1 · max: 256required -
The unique identifier of the AI Index.
-
memory_enabledboolean -
Whether this AI index accepts memory writes. Defaults to true when omitted.
-
sourcesanyOf · max: 100 · default: [] -
Additional sources that provide context for the AI Index. Defaults to an empty array when omitted.
-
tracesanyOf · max: 100 · default: [] -
Trace sources linked to this AI Index. A write replaces the whole array. Defaults to an empty array when omitted.
Responses
The AI Index was created.
-
statusrequired -
Values:
created
The request was invalid, for example a malformed dest, an invalid ES|QL source, or an unresolvable connector source or trace.
-
errorstring -
The HTTP status text.
-
messagestringrequired -
A human-readable error message.
-
statusCodenumber -
The HTTP status code.
Elasticsearch denied the index trace lookup outright; the caller lacks index privileges for it.
-
errorstring -
The HTTP status text.
-
messagestringrequired -
A human-readable error message.
-
statusCodenumber -
The HTTP status code.
Context Engine is turned off in this space.
-
errorstring -
The HTTP status text.
-
messagestringrequired -
A human-readable error message.
-
statusCodenumber -
The HTTP status code.
An AI Index with the same ID already exists, or the write conflicted.
-
errorstring -
The HTTP status text.
-
messagestringrequired -
A human-readable error message.
-
statusCodenumber -
The HTTP status code.