---
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/4641/api/doc/kibana/v8/operation/operation-findknowledgebaseentries
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-findknowledgebaseentries
products:
  - Kibana
---

# Finds Knowledge Base Entries that match the given query.

Authentication: required

- 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`

#### 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](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

Finds Knowledge Base Entries that match the given query.

## Query string parameters

- `fields` (string[]) — optional
  A list of fields to include in the response. If not provided, all fields will be included.
  Example: `["title","created_at"]`
- `filter` (string) — optional
  Search query to filter Knowledge Base Entries by specific criteria.
  Example: `error handling`
- `sort_field` (enum) — optional
  Field to sort the Knowledge Base Entries by.
  Values: `created_at`, `is_default`, `title`, `updated_at`
- `sort_order` (enum) — optional
  Sort order for the results, either asc or desc.
  Values: `asc`, `desc`
- `page` (integer · min: 1 · default: 1) — optional
  Page number for paginated results. Defaults to 1.
- `per_page` (integer · min: 0 · default: 20) — optional
  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 anyOf[])
  The list of Knowledge Base Entries for the current page.
  - **type: document**
    - `type` (enum)
      Entry type.
      Values: `document`
    - `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 · format: nonempty · min length: 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`, `user`
    - `source` (string)
      Source document name or filepath.
    - `text` (string)
      Knowledge Base Entry content.
    - `required` (boolean)
      Whether this resource should always be included, defaults to false.
    - `vector` (object)
      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.
  - **type: index**
    - `type` (enum)
      Entry type.
      Values: `index`
    - `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 · format: nonempty · min length: 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.
    - `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`

Generic Error indicating an issue with the request.

`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

#### Console

```console
GET kbn:/api/security_ai_assistant/knowledge_base/entries/_find
```

#### curl

```curl
curl -X GET "${KIBANA_URL}/api/security_ai_assistant/knowledge_base/entries/_find" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "data": [
    {
      "global": false,
      "name": "Example Entry",
      "namespace": "default",
      "users": [
        {
          "id": "user123",
          "name": "John Doe"
        }
      ],
      "createdAt": "2023-01-01T12:00:00Z",
      "createdBy": "admin",
      "id": "I am a string",
      "updatedAt": "2023-01-02T12:00:00Z",
      "updatedBy": "editor",
      "kbResource": "security_labs",
      "source": "/documents/example.txt",
      "text": "This is the content of the document.",
      "type": "document",
      "required": false,
      "vector": {
        "modelId": "bert-base-uncased",
        "tokens": {
          "token1": 0.123,
          "token2": 0.456
        }
      }
    }
  ],
  "page": 1,
  "perPage": 20,
  "total": 100
}
```

#### 400

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

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

