Query AI Indices
- Base URL
-
https://{kibana_url}
- POST /api/context_engine/ai_index/_query
- POST /s/{space_id}/api/context_engine/ai_index/_query
Runs an ES|QL query as the current user. The server applies a space filter and limits the response to at most 1000 rows. When the body carries user_id, rows are also limited to documents with that user_id or no user_id.
The query determines which indices it reads. Elasticsearch index privileges limit which indices the current user can access.
The space comes from the request URL (/s/{spaceId}/…) or defaults to the default space. The request body cannot change the space or replace the space filter.
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
contextEngine:read
Path parameters
-
space_idstringoptional -
An identifier for the space. If
space_idis not provided in the URL, the default space is used. Refer to Spaces for more information.
Request body
Responses
The columns and rows returned by the ES|QL query.
The ES|QL query was invalid, or its response exceeded the size limit.
Elasticsearch rejected the read; the caller lacks index privileges.