Type to search.

Create or update an AI Index

Base URL
https://{kibana_url}
Auth The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Creates an AI Index with the given ID, or replaces an existing one. The request body replaces the whole record: omitted fields are removed, and omitted arrays become empty. A managed AI Index cannot be replaced and returns a 409.

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 privileges

Privileges contextEngine:write

Path parameters

space_id string optional

An identifier for the space. If space_id is not provided in the URL, the default space is used. Refer to Spaces for more information.

aiIndexId string · min length: 1 · max length: 256 required

The unique identifier of the AI Index.

Header parameters

kbn-xsrf string required

A required header to protect against CSRF attacks

Request body

description string · max length: 2048

Human-readable description of the AI Index.

dest object required

The data stream or index that backs the AI Index.

type enum required

The type of the backing store. data_stream for a data stream, or index for an index.

Values: data_stream index
value string · min length: 1 · max length: 1024 required

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), match type, and start with ai-index-ds- (for data_stream) or ai-index-idx- (for index). The rest of the value must be a valid AI Index ID. System indices are not allowed.

memory_enabled boolean

Whether this AI index accepts memory writes. Defaults to true when omitted.

sources union anyOf[] · max items: 100 · default: []

Additional sources that provide context for the AI Index. Defaults to an empty array when omitted.

Any of:
type enum required
Values: esql
value string · min length: 1 · max length: 10240 required

The source value; an ES|QL query when type is esql. Must be valid ES|QL.

traces union anyOf[] · max items: 100 · default: []

Trace sources linked to this AI Index. A write replaces the whole array. Defaults to an empty array when omitted.

Any of:
type enum required
Values: elastic_agent
value string · min length: 1 · max length: 10240 required

The Agent Builder agent ID.

Responses

The AI Index was updated.

application/json
status enum required
Values: updated