---
type: api
title: Finds Knowledge Base Entries that match the given query.
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-findknowledgebaseentries
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/operation/operation-findknowledgebaseentries
products:
  - Kibana
---

# Finds Knowledge Base Entries that match the given query.

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/security_ai_assistant/knowledge_base/entries/_find`
- `GET` `/s/{space_id}/api/security_ai_assistant/knowledge_base/entries/_find`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana-serverless/authentication#apikeyauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Finds Knowledge Base Entries that match the given query.

## Query String Parameters

- `fields` ([] string)
  A list of fields to include in the response. If not provided, all fields will be included.
- `filter` (string)
  Search query to filter Knowledge Base Entries by specific criteria.
- `sort_field` (enum)
  Field to sort the Knowledge Base Entries by.
  Values: `created_at`, `is_default`, `title`, `updated_at`
- `sort_order` (enum)
  Sort order for the results, either asc or desc.
  Values: `asc`, `desc`
- `page` (integer · min: 1 · default: 1)
  Page number for paginated results. Defaults to 1.
- `per_page` (integer · min: 0 · default: 20)
  Number of Knowledge Base Entries to return per page. Defaults to 20.

## Responses

#### `200`

Successful response containing the paginated Knowledge Base Entries.

`application/json`

- `data` ([] union)
  The list of Knowledge Base Entries for the current page.
  - **DocumentEntry**
    - `global` (boolean)
      Whether this Knowledge Base Entry is global, defaults to false.
    - `name` (string)
      Name of the Knowledge Base Entry.
    - `namespace` (string)
      Kibana Space, defaults to 'default' space.
    - `users` ([] object)
      Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
      - `id` (string)
        User id.
      - `name` (string)
        User name.
    - `createdAt` (string)
      Time the Knowledge Base Entry was created.
    - `createdBy` (string)
      User who created the Knowledge Base Entry.
    - `id` (string · min: 1)
      A string that does not contain only whitespace characters.
    - `updatedAt` (string)
      Time the Knowledge Base Entry was last updated.
    - `updatedBy` (string)
      User who last updated the Knowledge Base Entry.
    - `kbResource` (enum)
      Knowledge Base resource name for grouping entries, e.g. 'security_labs', 'user', etc.
      Values: `security_labs`, `defend_insights`, `user`
    - `source` (string)
      Source document name or filepath.
    - `text` (string)
      Knowledge Base Entry content.
    - `type` (enum)
      Entry type.
      Values: `document`
    - `required` (boolean)
      Whether this resource should always be included, defaults to false.
    - `vector` ({})
      Object containing Knowledge Base Entry text embeddings and modelId used to create the embeddings.
      - `modelId` (string)
        ID of the model used to create the embeddings.
      - `tokens` (map string to number)
        Tokens with their corresponding values.
  - **IndexEntry**
    - `global` (boolean)
      Whether this Knowledge Base Entry is global, defaults to false.
    - `name` (string)
      Name of the Knowledge Base Entry.
    - `namespace` (string)
      Kibana Space, defaults to 'default' space.
    - `users` ([] object)
      Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
      - `id` (string)
        User id.
      - `name` (string)
        User name.
    - `createdAt` (string)
      Time the Knowledge Base Entry was created.
    - `createdBy` (string)
      User who created the Knowledge Base Entry.
    - `id` (string · min: 1)
      A string that does not contain only whitespace characters.
    - `updatedAt` (string)
      Time the Knowledge Base Entry was last updated.
    - `updatedBy` (string)
      User who last updated the Knowledge Base Entry.
    - `description` (string)
      Description for when this index or data stream should be queried for Knowledge Base content. Passed to the LLM as a tool description.
    - `field` (string)
      Field to query for Knowledge Base content.
    - `index` (string)
      Index or Data Stream to query for Knowledge Base content.
    - `queryDescription` (string)
      Description of query field used to fetch Knowledge Base content. Passed to the LLM as part of the tool input schema.
    - `type` (enum)
      Entry type.
      Values: `index`
    - `inputSchema` ([] object)
      Array of objects defining the input schema, allowing the LLM to extract structured data to be used in retrieval.
      - `description` (string)
        Description of the field.
      - `fieldName` (string)
        Name of the field.
      - `fieldType` (string)
        Type of the field.
    - `outputFields` ([] string)
      Fields to extract from the query result, defaults to all fields if not provided or empty.
- `page` (integer)
  The current page number.
- `perPage` (integer)
  The number of Knowledge Base Entries returned per page.
- `total` (integer)
  The total number of Knowledge Base Entries available.
#### `400`

Bad Request response.

`application/json`

- `error` (string)
  A short description of the error.
- `message` (string)
  A detailed message explaining the error.
- `statusCode` (number)
  The HTTP status code of the error.
## Code Examples

#### curl

```curl
curl \
 --request GET 'http://localhost:5601/api/security_ai_assistant/knowledge_base/entries/_find?page=1&per_page=20' \
 --header "Authorization: $API_KEY"
```

## Response Examples

#### Find knowledge base entries response200

```json
{
  "data": [
    {
      "createdAt": "2024-01-15T10:00:00.000Z",
      "createdBy": "user@example.com",
      "global": false,
      "id": "12345",
      "kbResource": "user",
      "name": "How to reset a password",
      "namespace": "default",
      "source": "manual",
      "text": "To reset your password, go to the settings page and click \u0027Reset Password\u0027.",
      "type": "document",
      "updatedAt": "2024-01-15T10:00:00.000Z",
      "updatedBy": "user@example.com"
    }
  ],
  "page": 1,
  "perPage": 20,
  "total": 100
}
```

#### Find knowledge base entries response400

```json
{
  "error": "Bad Request",
  "message": "Invalid query parameter: sort_order",
  "statusCode": 400
}
```

