---
type: api
title: Initialize the Entity Store
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-initentitystore
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-initentitystore
products:
  - Kibana
---

# Initialize the Entity Store

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

## Paths

- `POST` `/api/entity_store/enable`
- `POST` `/s/{space_id}/api/entity_store/enable`

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

## Description

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

Initialize the entire Entity Store, creating engines for all or specified entity types.

## Request Body

`application/json`

Configuration for the entity store initialization.

- `delay` (string · pattern: [smdh]$ · default: 1m) — optional
  The delay before the transform will run.
- `docsPerSecond` (integer) — optional
  The number of documents per second to process.
- `enrichPolicyExecutionInterval` (string · pattern: ^[1-9]\d*[smh]$) — optional
  Interval in which enrich policy runs. For example, `"1h"` means the rule runs every hour. Must be less than or equal to half the duration of the lookback period,
- `entityTypes` ([] enum) — optional
  Values: `user`, `host`, `service`
- `fieldHistoryLength` (integer · default: 10) — optional
  The number of historical values to keep for each field.
- `filter` (string) — optional
- `frequency` (string · pattern: [smdh]$ · default: 1m) — optional
  The frequency at which the transform will run.
- `indexPattern` (string) — optional
  An additional Elasticsearch index pattern to include as a source for entity data. Merged with the default data view indices when the engine runs.
- `lookbackPeriod` (string · pattern: [smdh]$ · default: 24h) — optional
  The amount of time the transform looks back to calculate the aggregations.
- `timeout` (string · pattern: [smdh]$ · default: 180s) — optional
  The timeout for initializing the aggregating transform.
- `timestampField` (string · default: @timestamp) — optional
  The field to use as the timestamp.

## Responses

#### `200`

Successful response

`application/json`

- `engines` ([] object)
  The engine descriptors created during initialization.
  - `delay` (string · pattern: [smdh]$ · default: 1m)
    The delay before the transform processes new data, allowing late-arriving documents to be included.
  - `docsPerSecond` (integer)
    Throttle value for the number of documents processed per second. Use -1 for no throttle.
  - `error` (object)
    Present when the engine status is `error`. Describes the failure.
    - `action` (enum)
      The lifecycle action that caused the error.
      Values: `init`
    - `message` (string)
      A human-readable error message.
  - `fieldHistoryLength` (integer)
    The number of historical values retained per field.
  - `filter` (string)
    An optional Kibana Query Language (KQL) filter applied to source documents before aggregation.
  - `frequency` (string · pattern: [smdh]$ · default: 1m)
    How often the transform runs.
  - `indexPattern` (string)
    An additional Elasticsearch index pattern to include as a source for entity data. Merged with the default data view indices when the engine runs.
  - `lookbackPeriod` (string · pattern: [smdh]$ · default: 24h)
    How far back the transform looks when calculating aggregations.
  - `status` (enum)
    The current operational status of an entity engine.
    Values: `installing`, `started`, `stopped`, `updating`, `error`
  - `timeout` (string · pattern: [smdh]$ · default: 180s)
    The timeout for initializing the aggregating transform.
  - `timestampField` (string)
    The field used as the timestamp for source documents.
  - `type` (enum)
    The type of entity.
    Values: `user`, `host`, `service`
- `succeeded` (boolean)
  Whether the Entity Store was initialized successfully.
#### `400`

Invalid request

## Code Examples

#### Console

```console
POST /api/entity_store/enable
{
  "entityTypes": [
    "host",
    "user"
  ]
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/entity_store/enable" \
  -H "Content-Type: application/json" \
  -d '{
  "entityTypes": [
    "host",
    "user"
  ]
}'
```

## Response Examples

#### Entity Store initialized with host and user engines

The Entity Store was successfully initialized, creating host and user engines in the installing state.

```json
{
  "engines": [
    {
      "delay": "1m",
      "fieldHistoryLength": 10,
      "frequency": "1m",
      "indexPattern": "",
      "lookbackPeriod": "24h",
      "status": "installing",
      "timeout": "180s",
      "timestampField": "@timestamp",
      "type": "host"
    },
    {
      "delay": "1m",
      "fieldHistoryLength": 10,
      "frequency": "1m",
      "indexPattern": "",
      "lookbackPeriod": "24h",
      "status": "installing",
      "timeout": "180s",
      "timestampField": "@timestamp",
      "type": "user"
    }
  ],
  "succeeded": true
}
```

