EntityAnalyticsClient

Client for the Kibana Security Entity Analytics API.

Entity Analytics surfaces risk and privilege insights for entities (hosts, users, services and generic entities) observed by the Elastic Security solution. The client covers asset criticality, the risk scoring engine, privileged user monitoring (including the privileged access detection ML package), watchlists (Technical Preview in 9.4) and the Entity Store.

All Entity Analytics resources are space-scoped: every method accepts an optional space_id to target a specific space.

Note

The asset criticality endpoints are deprecated in Kibana 9.4 in favor of the Entity Store entity APIs, but remain fully functional. On deployments where Entity Store V2 is enabled, the legacy public risk engine routes (schedule_risk_engine_now, configure_risk_engine_saved_object, cleanup_risk_engine) are not registered and answer 404.

class kibana._sync.client.entity_analytics.EntityAnalyticsClient(client, default_space_id=None, validate_spaces=True)[source]

Bases: NamespaceClient

Client for the Kibana Security Entity Analytics API.

Entity Analytics surfaces risk and privilege insights for entities (hosts, users, services and generic entities) observed by the Elastic Security solution. This client covers the Kibana 9.4.3 Entity Analytics REST APIs:

  • Asset criticality (/api/asset_criticality): classify how critical an entity is (deprecated in 9.4 in favor of the Entity Store).

  • Risk engine (/api/risk_score/engine): schedule, configure and clean up the risk scoring engine.

  • Privilege monitoring (/api/entity_analytics/monitoring): manage the Privilege Monitoring Engine and monitored privileged users, including CSV bulk upload.

  • Privileged access detection (.../privileged_user_monitoring/pad): install and inspect the PAD ML package.

  • Watchlists (/api/entity_analytics/watchlists): group entities and apply risk modifiers (Technical Preview in 9.4).

  • Entity Store (/api/security/entity_store): install, manage and query the entity store, including direct entity CRUD and entity resolution (linking).

All Entity Analytics resources are space-scoped: every method accepts an optional space_id to target a specific space (None targets the default space or the space the client is scoped to).

Example

>>> from kibana import Kibana
>>> client = Kibana("http://localhost:5601", api_key="...")
>>>
>>> # Classify an asset and read it back
>>> client.entity_analytics.create_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     criticality_level="high_impact",
... )
>>> record = client.entity_analytics.get_asset_criticality(
...     id_field="host.name", id_value="my-host"
... )
>>>
>>> # Install the Entity Store and check its status
>>> client.entity_analytics.install_entity_store(entity_types=["host"])
>>> status = client.entity_analytics.get_entity_store_status()
>>> print(status.body["status"])

Classifying Asset Criticality

from kibana import Kibana

client = Kibana("http://localhost:5601", api_key="your_api_key")

# Upsert a single record
client.entity_analytics.create_asset_criticality(
    id_field="host.name",
    id_value="web-01",
    criticality_level="high_impact",
    refresh="wait_for",
)

# Bulk upsert ("unassigned" removes an assignment)
client.entity_analytics.bulk_upsert_asset_criticality(
    records=[
        {
            "id_field": "user.name",
            "id_value": "alice",
            "criticality_level": "medium_impact",
        },
    ]
)

# Read and search records
record = client.entity_analytics.get_asset_criticality(
    id_field="host.name", id_value="web-01"
)
found = client.entity_analytics.find_asset_criticality(
    kuery="criticality_level: high_impact", per_page=100
)

# Delete a record
client.entity_analytics.delete_asset_criticality(
    id_field="host.name", id_value="web-01"
)

Privileged User Monitoring

# Initialize the Privilege Monitoring Engine for the space
client.entity_analytics.init_monitoring_engine()

# Add monitored users one by one or in bulk via CSV
user = client.entity_analytics.create_monitored_user(name="admin-user")
client.entity_analytics.upload_monitored_users_csv(
    file="admin-1\nadmin-2\n"
)

# Inspect and manage
users = client.entity_analytics.list_monitored_users(
    kql="user.name: admin*"
)
client.entity_analytics.schedule_monitoring_engine_now()
health = client.entity_analytics.get_monitoring_health()

# Disable or remove the engine (data=True also deletes the users)
client.entity_analytics.disable_monitoring_engine()
client.entity_analytics.delete_monitoring_engine(data=True)

# Privileged access detection (PAD) ML package
client.entity_analytics.install_pad_package()
pad = client.entity_analytics.get_pad_status()

Watchlists (Technical Preview)

watchlist = client.entity_analytics.create_watchlist(
    name="High Risk Vendors",
    risk_modifier=1.5,
    description="High risk vendor watchlist",
)
watchlist_id = watchlist.body["id"]

# Add entities from a CSV (matched against the Entity Store)
client.entity_analytics.upload_watchlist_csv(
    watchlist_id=watchlist_id,
    file="type,name\nhost,web-01\n",
)

# Manual entity assignment by EUID
client.entity_analytics.assign_watchlist_entities(
    watchlist_id=watchlist_id, euids=["host:web-01"]
)
client.entity_analytics.unassign_watchlist_entities(
    watchlist_id=watchlist_id, euids=["host:web-01"]
)

client.entity_analytics.delete_watchlist(id=watchlist_id)

Managing the Entity Store

# Install engines and wait until the store is running
client.entity_analytics.install_entity_store(
    entity_types=["host", "user"],
    log_extraction={"frequency": "5m", "lookbackPeriod": "12h"},
)
status = client.entity_analytics.get_entity_store_status(
    include_components=True
)

# Query and manage entities
entities = client.entity_analytics.list_entities(
    entity_types=["host"], sort_field="entity.name", per_page=100
)
client.entity_analytics.create_entity(
    entity_type="host", document={"host": {"name": "web-01"}}
)

# Entity resolution: link duplicates to a canonical entity
client.entity_analytics.link_entities(
    entity_ids=["host:web-01.internal"], target_id="host:web-01"
)
group = client.entity_analytics.get_entity_resolution_group(
    entity_id="host:web-01"
)

# Pause, resume or remove the store
client.entity_analytics.stop_entity_store()
client.entity_analytics.start_entity_store()
client.entity_analytics.uninstall_entity_store()
__init__(client, default_space_id=None, validate_spaces=True)[source]

Initialize the EntityAnalyticsClient.

Parameters:
  • client (Kibana) – The parent Kibana client instance to delegate requests to.

  • default_space_id (str | None) – Optional default space ID for all operations.

  • validate_spaces (bool) – Whether to validate space existence before space-scoped operations (default: True).

Example

>>> entity_analytics_client = EntityAnalyticsClient(kibana_client)
create_asset_criticality(*, id_field, id_value, criticality_level, refresh=None, space_id=None, validate_spaces=None)[source]

Upsert an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead (e.g. update_entity()).

POST /api/asset_criticality. Creates or updates (upserts) the asset criticality record for the given entity. If a record already exists for the specified entity, that record is overwritten. If no record exists, a new record is created.

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity (e.g. the host name).

  • criticality_level (str) – The criticality level. One of "low_impact", "medium_impact", "high_impact", "extreme_impact".

  • refresh (str | None) – If "wait_for", wait for a refresh so the created record is visible to subsequent searches.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created/updated record (id_field, id_value, criticality_level, @timestamp, asset and the entity field object).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> record = client.entity_analytics.create_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     criticality_level="high_impact",
...     refresh="wait_for",
... )
>>> print(record.body["criticality_level"])
high_impact
get_asset_criticality(*, id_field, id_value, space_id=None, validate_spaces=None)[source]

Get an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

GET /api/asset_criticality. Gets the asset criticality record for the given entity.

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the asset criticality record.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> record = client.entity_analytics.get_asset_criticality(
...     id_field="host.name", id_value="my-host"
... )
>>> print(record.body["criticality_level"])
delete_asset_criticality(*, id_field, id_value, refresh=None, space_id=None, validate_spaces=None)[source]

Delete an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

DELETE /api/asset_criticality. Deletes the asset criticality record for the given entity. If no record exists, the response reports deleted: false (no error is raised).

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity.

  • refresh (str | None) – If "wait_for", wait for a refresh so the deletion is visible to subsequent searches.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool) and, if a record was deleted, the deleted record.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.delete_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     refresh="wait_for",
... )
>>> print(result.body["deleted"])
True
bulk_upsert_asset_criticality(*, records, space_id=None, validate_spaces=None)[source]

Bulk upsert asset criticality records.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

POST /api/asset_criticality/bulk. Bulk creates or updates (up to 1000) asset criticality records. If a record already exists for the specified entity, that record is overwritten. In addition to the regular criticality levels, bulk upload accepts the special "unassigned" level, which removes the record’s criticality assignment.

Parameters:
  • records (list[dict[str, Any]]) – Records to upsert. Each record requires id_field (one of "host.name", "user.name", "service.name", "entity.id"), id_value and criticality_level ("low_impact", "medium_impact", "high_impact", "extreme_impact" or "unassigned").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with errors (per-record failures, with the record index) and stats (successful/failed/total).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.bulk_upsert_asset_criticality(
...     records=[
...         {
...             "id_field": "host.name",
...             "id_value": "my-host",
...             "criticality_level": "high_impact",
...         },
...         {
...             "id_field": "user.name",
...             "id_value": "my-user",
...             "criticality_level": "low_impact",
...         },
...     ]
... )
>>> print(result.body["stats"]["successful"])
2
find_asset_criticality(*, sort_field=None, sort_direction=None, page=None, per_page=None, kuery=None, space_id=None, validate_spaces=None)[source]

List asset criticality records.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

GET /api/asset_criticality/list. Lists asset criticality records, paging, sorting and filtering as needed.

Parameters:
  • sort_field (str | None) – The field to sort by. One of "id_value", "id_field", "criticality_level", "@timestamp".

  • sort_direction (str | None) – The order to sort by: "asc" or "desc".

  • page (int | None) – The page number to return (>= 1).

  • per_page (int | None) – The number of records to return per page (1-1000).

  • kuery (str | None) – A KQL string to filter the records (e.g. 'host.name: my-host').

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with records, total, page and per_page.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> found = client.entity_analytics.find_asset_criticality(
...     kuery="criticality_level: high_impact",
...     sort_field="@timestamp",
...     sort_direction="desc",
...     per_page=100,
... )
>>> print(found.body["total"])
schedule_risk_engine_now(*, space_id=None, validate_spaces=None)[source]

Run the risk scoring engine immediately.

POST /api/risk_score/engine/schedule_now. Schedules the risk scoring engine to run as soon as possible. Use this to recalculate entity risk scores after updating the risk engine configuration.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with success (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.schedule_risk_engine_now()
>>> print(result.body["success"])
configure_risk_engine_saved_object(*, enable_reset_to_zero=None, exclude_alert_statuses=None, exclude_alert_tags=None, filters=None, page_size=None, range=None, space_id=None, validate_spaces=None)[source]

Configure the risk engine saved object.

PATCH /api/risk_score/engine/saved_object/configure. Configures the risk engine saved object with new settings such as the alert date range, excluded alert statuses/tags and entity filters.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • enable_reset_to_zero (bool | None) – Whether risk scores of entities without recent alerts are reset to zero.

  • exclude_alert_statuses (list[str] | None) – Alert workflow statuses to exclude from risk scoring (e.g. ["closed"]).

  • exclude_alert_tags (list[str] | None) – Alert tags to exclude from risk scoring.

  • filters (list[dict[str, Any]] | None) – Entity filters. Each filter requires entity_types (list of "host"/"user"/"service") and filter (a KQL string).

  • page_size (int | None) – Number of entities to score per page (100-10000).

  • range (dict[str, str] | None) – The alert date range to consider, an object with start and end date-math strings (e.g. {"start": "now-30d", "end": "now"}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with risk_engine_saved_object_configured (bool) on success.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> client.entity_analytics.configure_risk_engine_saved_object(
...     range={"start": "now-30d", "end": "now"},
...     exclude_alert_statuses=["closed"],
... )
cleanup_risk_engine(*, space_id=None, validate_spaces=None)[source]

Clean up the risk engine, deleting all risk scoring data.

DELETE /api/risk_score/engine/dangerously_delete_data. Permanently cleans up the risk engine by deleting the risk scoring task, removing risk score transforms and deleting all risk score data and indices. This operation destroys data and cannot be undone.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with risk_engine_cleanup (bool); on partial failure the body contains a cleanup_agent_policies / errors task failure payload.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.cleanup_risk_engine()
init_monitoring_engine(*, space_id=None, validate_spaces=None)[source]

Initialize the Privilege Monitoring Engine.

POST /api/entity_analytics/monitoring/engine/init. Initializes the Privilege Monitoring Engine for the space, creating the monitored-users index and the monitoring task. The call is idempotent: initializing an already-started engine succeeds.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with the engine status (e.g. "started") and, on failure, an error object.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.init_monitoring_engine()
>>> print(result.body["status"])
started
disable_monitoring_engine(*, space_id=None, validate_spaces=None)[source]

Disable the Privilege Monitoring Engine.

POST /api/entity_analytics/monitoring/engine/disable. Disables the Privilege Monitoring Engine without deleting its data. Use init_monitoring_engine() to re-enable it.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with the engine status (e.g. "disabled") and, on failure, an error object.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.disable_monitoring_engine()
>>> print(result.body["status"])
disabled
schedule_monitoring_engine_now(*, space_id=None, validate_spaces=None)[source]

Run the Privilege Monitoring Engine immediately.

POST /api/entity_analytics/monitoring/engine/schedule_now. Schedules the Privilege Monitoring Engine task to run as soon as possible instead of waiting for its next scheduled run.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with success (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.schedule_monitoring_engine_now()
>>> print(result.body["success"])
True
delete_monitoring_engine(*, data=None, space_id=None, validate_spaces=None)[source]

Delete the Privilege Monitoring Engine.

DELETE /api/entity_analytics/monitoring/engine/delete. Deletes the Privilege Monitoring Engine, removing its task and saved object.

Parameters:
  • data (bool | None) – If True, also delete the engine’s data (the monitored users index). Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.delete_monitoring_engine(data=True)
>>> print(result.body["deleted"])
True
get_monitoring_health(*, space_id=None, validate_spaces=None)[source]

Get the health of the Privilege Monitoring Engine.

GET /api/entity_analytics/monitoring/privileges/health. Runs a health check on privilege monitoring and returns the engine status for the space.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with status (e.g. "not_installed", "started", "disabled"), a users count summary when installed, and an error object on engine failure.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> health = client.entity_analytics.get_monitoring_health()
>>> print(health.body["status"])
get_monitoring_privileges(*, space_id=None, validate_spaces=None)[source]

Check the current user’s privilege-monitoring privileges.

GET /api/entity_analytics/monitoring/privileges/privileges. Runs a privileges check for privilege monitoring, reporting which Elasticsearch index privileges the current user holds.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with privileges (per-index privilege flags) and has_all_required (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.get_monitoring_privileges()
>>> print(result.body["has_all_required"])
create_monitored_user(*, name, monitoring_labels=None, space_id=None, validate_spaces=None)[source]

Create a new monitored (privileged) user.

POST /api/entity_analytics/monitoring/users. Adds a user to privileged user monitoring. The user is marked as privileged with source "api".

Parameters:
  • name (str) – The name of the user to monitor.

  • monitoring_labels (list[dict[str, Any]] | None) – Optional labels to associate with the user. Each label object supports field, value and source (one of "api", "csv", "index_sync").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created monitored-user document (id, user, labels, entity_analytics_monitoring, @timestamp).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> user = client.entity_analytics.create_monitored_user(
...     name="admin-user"
... )
>>> print(user.body["user"]["is_privileged"])
True
update_monitored_user(*, id, doc, space_id=None, validate_spaces=None)[source]

Update a monitored user.

PUT /api/entity_analytics/monitoring/users/{id}. Applies a partial update to a monitored-user document.

Parameters:
  • id (str) – The ID of the monitored-user document to update.

  • doc (dict[str, Any]) – The partial monitored-user document to apply. Supports user ({"name": ..., "is_privileged": ...}), labels ({"sources": [...], "source_ids": [...], "source_integrations": [...]}) and entity_analytics_monitoring ({"labels": [...]}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the updated monitored-user document.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = client.entity_analytics.update_monitored_user(
...     id="OflsOZ8BiXLbCmmNbJ9J",
...     doc={"user": {"name": "admin-user", "is_privileged": True}},
... )
>>> print(updated.body["user"]["name"])
admin-user
delete_monitored_user(*, id, space_id=None, validate_spaces=None)[source]

Delete a monitored user.

DELETE /api/entity_analytics/monitoring/users/{id}. Removes a user from privileged user monitoring.

Parameters:
  • id (str) – The ID of the monitored-user document to delete.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with acknowledged (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.delete_monitored_user(
...     id="OflsOZ8BiXLbCmmNbJ9J"
... )
>>> print(result.body["acknowledged"])
True
list_monitored_users(*, kql=None, space_id=None, validate_spaces=None)[source]

List monitored (privileged) users.

GET /api/entity_analytics/monitoring/users/list. Lists all monitored users in the space, optionally filtered with KQL.

Parameters:
  • kql (str | None) – KQL query to filter the monitored users (e.g. 'user.name: admin*').

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse whose body is a list of monitored-user documents.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> users = client.entity_analytics.list_monitored_users(
...     kql="user.name: admin*"
... )
>>> for user in users.body:
...     print(user["user"]["name"])
upload_monitored_users_csv(*, file, filename='users.csv', space_id=None, validate_spaces=None)[source]

Bulk upsert monitored users via CSV upload.

POST /api/entity_analytics/monitoring/users/_csv. Uploads a CSV file (as multipart/form-data) containing one user name per line to add or update multiple monitored users at once.

Parameters:
  • file (bytes | str) – The CSV content as bytes or str (one user name per line).

  • filename (str) – Filename advertised in the multipart upload.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with errors and stats (successfulOperations/failedOperations/uploaded/ totalOperations).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.upload_monitored_users_csv(
...     file="admin-1\nadmin-2\n"
... )
>>> print(result.body["stats"]["uploaded"])
2
install_pad_package(*, space_id=None, validate_spaces=None)[source]

Install the privileged access detection (PAD) package.

POST /api/entity_analytics/privileged_user_monitoring/pad/install. Installs the privileged access detection integration package, which provides machine-learning jobs for detecting anomalous privileged activity. The call is idempotent.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with a confirmation message.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.install_pad_package()
>>> print(result.body["message"])
Successfully installed privileged access detection package.
get_pad_status(*, space_id=None, validate_spaces=None)[source]

Get the status of the privileged access detection (PAD) package.

GET /api/entity_analytics/privileged_user_monitoring/pad/status. Reports whether the PAD integration package is installed, whether its ML module has been set up, and the state of its ML jobs.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with package_installation_status ("complete"/"incomplete"), ml_module_setup_status and jobs (per-job state).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> status = client.entity_analytics.get_pad_status()
>>> print(status.body["package_installation_status"])
create_watchlist(*, name, risk_modifier, description=None, managed=None, entity_sources=None, space_id=None, validate_spaces=None)[source]

Create a new watchlist.

Technical preview in 9.4. POST /api/entity_analytics/watchlists. Creates a watchlist that groups entities and applies a risk score modifier to them, optionally creating and linking entity sources.

Parameters:
  • name (str) – Unique name for the watchlist.

  • risk_modifier (float) – Risk score modifier associated with the watchlist (0-2).

  • description (str | None) – Description of the watchlist.

  • managed (bool | None) – Whether the watchlist is managed by the system.

  • entity_sources (list[dict[str, Any]] | None) – Optional entity sources to create and link to the watchlist. Each source requires type (one of "index", "entity_analytics_integration", "store") and name, and supports enabled, indexPattern, identifierField, integrationName, matchers, filter, queryRule and range.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created watchlist (id, name, riskModifier, entitySourceIds, createdAt, updatedAt).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlist = client.entity_analytics.create_watchlist(
...     name="High Risk Vendors",
...     risk_modifier=1.5,
...     description="High risk vendor watchlist",
... )
>>> print(watchlist.body["id"])
list_watchlists(*, space_id=None, validate_spaces=None)[source]

List all watchlists.

Technical preview in 9.4. GET /api/entity_analytics/watchlists/list. Lists all watchlists in the space.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse whose body is a list of watchlists.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlists = client.entity_analytics.list_watchlists()
>>> for watchlist in watchlists.body:
...     print(watchlist["name"], watchlist["riskModifier"])
get_watchlist(*, id, space_id=None, validate_spaces=None)[source]

Get a watchlist by ID.

Technical preview in 9.4. GET /api/entity_analytics/watchlists/{id}.

Parameters:
  • id (str) – The ID of the watchlist.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the watchlist (id, name, riskModifier, entitySourceIds, entityCount, …).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlist = client.entity_analytics.get_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8"
... )
>>> print(watchlist.body["name"])
update_watchlist(*, id, name, risk_modifier, description=None, managed=None, space_id=None, validate_spaces=None)[source]

Update an existing watchlist.

Technical preview in 9.4. PUT /api/entity_analytics/watchlists/{id}. Updates a watchlist’s name, description, risk modifier or managed flag. name and risk_modifier are required by the API even when unchanged.

Parameters:
  • id (str) – The ID of the watchlist to update.

  • name (str) – Unique name for the watchlist.

  • risk_modifier (float) – Risk score modifier associated with the watchlist (0-2).

  • description (str | None) – Description of the watchlist.

  • managed (bool | None) – Whether the watchlist is managed by the system.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the updated watchlist.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = client.entity_analytics.update_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     name="High Risk Vendors",
...     risk_modifier=1.8,
... )
>>> print(updated.body["riskModifier"])
1.8
delete_watchlist(*, id, space_id=None, validate_spaces=None)[source]

Delete a watchlist by ID.

Technical preview in 9.4. DELETE /api/entity_analytics/watchlists/{id}. Deletes a watchlist. This route is supported by Kibana 9.4.3 but is not documented in its OpenAPI specification.

Parameters:
  • id (str) – The ID of the watchlist to delete.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.delete_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8"
... )
>>> print(result.body["deleted"])
True
upload_watchlist_csv(*, watchlist_id, file, filename='watchlist.csv', space_id=None, validate_spaces=None)[source]

Upload a CSV file to add entities to a watchlist.

Technical preview in 9.4. POST /api/entity_analytics/watchlists/{watchlist_id}/csv_upload. Uploads a CSV file (as multipart/form-data) whose rows identify entities to add to the watchlist. The CSV requires a header row that includes a type column (e.g. type,name); entities are matched against the Entity Store, which must be installed.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • file (bytes | str) – The CSV content as bytes or str, including the header row (e.g. "type,name\nuser,alice\n").

  • filename (str) – Filename advertised in the multipart upload.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with total, successful, failed, unmatched and per-row items.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.upload_watchlist_csv(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     file="type,name\nuser,alice\nhost,web-01\n",
... )
>>> print(result.body["successful"])
assign_watchlist_entities(*, watchlist_id, euids, space_id=None, validate_spaces=None)[source]

Manually assign entities to a watchlist.

Technical preview in 9.4 (added in 9.4.0). POST /api/entity_analytics/watchlists/{watchlist_id}/entities/assign. Assigns Entity Store entities (by EUID) to the watchlist. The Entity Store must be installed.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • euids (list[str]) – The entity unique IDs (EUIDs) to assign, e.g. ["host:web-01"].

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with successful, failed, not_found, total and per-entity items.

Raises:
  • NotFoundError – If the watchlist does not exist or the Entity Store indices are missing.

  • ApiError – Kibana 9.4.3 answers 500 "Unexpected entity store     record" when the entity was created through the entity CRUD APIs and has not been materialized by the Entity Store transform.

  • AuthenticationException – If authentication fails.

  • AuthorizationException – If insufficient privileges.

  • SpaceNotFoundError – If the space doesn’t exist and validation is enabled.

Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.assign_watchlist_entities(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     euids=["host:web-01"],
... )
>>> print(result.body["successful"])
unassign_watchlist_entities(*, watchlist_id, euids, space_id=None, validate_spaces=None)[source]

Manually unassign entities from a watchlist.

Technical preview in 9.4 (added in 9.4.0). POST /api/entity_analytics/watchlists/{watchlist_id}/entities/unassign. Removes manually-assigned Entity Store entities (by EUID) from the watchlist.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • euids (list[str]) – The entity unique IDs (EUIDs) to unassign.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with successful, failed, not_found, total and per-entity items.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.unassign_watchlist_entities(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     euids=["host:web-01"],
... )
>>> print(result.body["successful"])
install_entity_store(*, entity_types=None, log_extraction=None, history_snapshot=None, space_id=None, validate_spaces=None)[source]

Install the Entity Store.

POST /api/security/entity_store/install. Installs the Entity Store for the space, creating the entity indices, transforms and extraction tasks for the requested entity types.

Parameters:
  • entity_types (list[str] | None) – The entity types to install engines for, from "user", "host", "service", "generic". Defaults to all types on the server.

  • log_extraction (dict[str, Any] | None) – Log extraction settings. Supports frequency, lookbackPeriod, delay, fieldHistoryLength, filter, additionalIndexPatterns, excludedIndexPatterns, docsLimit, maxLogsPerPage, maxLogsPerWindow, maxLogsPerWindowCapBehavior ("defer"/"drop") and maxTimeWindowSize.

  • history_snapshot (dict[str, Any] | None) – History snapshot settings ({"frequency": "24h"}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.install_entity_store(
...     entity_types=["host"],
...     log_extraction={"frequency": "5m", "lookbackPeriod": "12h"},
... )
>>> print(result.body["ok"])
True
uninstall_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Uninstall the Entity Store.

POST /api/security/entity_store/uninstall. Uninstalls Entity Store engines, removing their transforms, tasks and indices. When entity_types is omitted, all engines are uninstalled.

Parameters:
  • entity_types (list[str] | None) – The entity types to uninstall engines for, from "user", "host", "service", "generic". Defaults to all installed types.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.uninstall_entity_store()
>>> print(result.body["ok"])
True
update_entity_store(*, log_extraction, space_id=None, validate_spaces=None)[source]

Update the Entity Store configuration.

PUT /api/security/entity_store. Updates the log extraction configuration of the installed Entity Store.

Parameters:
  • log_extraction (dict[str, Any]) – The log extraction settings to update. Supports the same keys as install_entity_store() (frequency, lookbackPeriod, delay, fieldHistoryLength, filter, additionalIndexPatterns, excludedIndexPatterns, docsLimit, maxLogsPerPage, maxLogsPerWindow, maxLogsPerWindowCapBehavior, maxTimeWindowSize).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.update_entity_store(
...     log_extraction={"frequency": "10m", "lookbackPeriod": "6h"}
... )
>>> print(result.body["ok"])
True
get_entity_store_status(*, include_components=None, space_id=None, validate_spaces=None)[source]

Get the status of the Entity Store.

GET /api/security/entity_store/status. Returns the overall Entity Store status ("not_installed", "installing", "running", "stopped" or "error") and the status of each engine.

Parameters:
  • include_components (bool | None) – If True, include the status of the Entity Store’s underlying components (transforms, index templates, indices, tasks, …) for each engine.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with status and engines (per-engine type, status and configuration; plus components when requested).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> status = client.entity_analytics.get_entity_store_status(
...     include_components=True
... )
>>> print(status.body["status"])
running
start_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Start Entity Store engines.

PUT /api/security/entity_store/start. Starts (resumes) the installed Entity Store engines. When entity_types is omitted, all installed engines are started.

Parameters:
  • entity_types (list[str] | None) – The entity types whose engines to start, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.start_entity_store()
>>> print(result.body["ok"])
True
stop_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Stop Entity Store engines.

PUT /api/security/entity_store/stop. Stops (pauses) the installed Entity Store engines without uninstalling them. When entity_types is omitted, all installed engines are stopped.

Parameters:
  • entity_types (list[str] | None) – The entity types whose engines to stop, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.stop_entity_store()
>>> print(result.body["ok"])
True
list_entities(*, filter=None, size=None, search_after=None, source=None, fields=None, sort_field=None, sort_order=None, page=None, per_page=None, filter_query=None, entity_types=None, space_id=None, validate_spaces=None)[source]

List Entity Store entities.

GET /api/security/entity_store/entities. Lists entities stored in the Entity Store, with paging, sorting and filtering.

Parameters:
  • filter (str | None) – An ES query-string filter (e.g. 'host.name: "web-01"').

  • size (int | None) – Maximum number of entities to return (cursor-style pagination, used with search_after).

  • search_after (str | None) – Cursor returned by a previous call, to fetch the next batch of results.

  • source (list[str] | None) – Index patterns to search for entities.

  • fields (list[str] | None) – Restrict the entity fields returned.

  • sort_field (str | None) – The field to sort by.

  • sort_order (str | None) – The sort order: "asc" or "desc".

  • page (int | None) – The page number to return (page-style pagination).

  • per_page (int | None) – The number of entities per page (up to 10000).

  • filter_query (str | None) – An additional filter as a JSON DSL query string.

  • entity_types (list[str] | None) – Restrict results to these entity types, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with records, total, page, per_page and an inspect object with the executed query.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> entities = client.entity_analytics.list_entities(
...     entity_types=["host"],
...     sort_field="entity.name",
...     sort_order="asc",
...     per_page=100,
... )
>>> print(entities.body["total"])
create_entity(*, entity_type, document, space_id=None, validate_spaces=None)[source]

Create an Entity Store entity.

POST /api/security/entity_store/entities/{entityType}. Creates an entity document directly in the Entity Store. The Entity Store must be installed for the given entity type.

Parameters:
  • entity_type (str) – The entity type: "user", "host", "service" or "generic".

  • document (dict[str, Any]) – The entity document. Must contain the type’s identity field (e.g. {"host": {"name": "web-01"}} for hosts) and supports entity, asset, labels, tags, event and @timestamp. If entity.id is provided it must match the EUID the server generates (e.g. "host:web-01").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.create_entity(
...     entity_type="host",
...     document={"host": {"name": "web-01"}},
... )
>>> print(result.body["ok"])
True
update_entity(*, entity_type, document, force=None, space_id=None, validate_spaces=None)[source]

Update an Entity Store entity.

PUT /api/security/entity_store/entities/{entityType}. Updates (upserts) an entity document in the Entity Store.

Parameters:
  • entity_type (str) – The entity type: "user", "host", "service" or "generic".

  • document (dict[str, Any]) – The entity document to apply. Must contain the type’s identity field (e.g. {"host": {"name": "web-01"}}).

  • force (bool | None) – If True, force the update even when the entity does not already exist. Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.update_entity(
...     entity_type="host",
...     document={
...         "host": {"name": "web-01"},
...         "labels": {"env": "prod"},
...     },
...     force=True,
... )
>>> print(result.body["ok"])
True
bulk_update_entities(*, entities, force=None, space_id=None, validate_spaces=None)[source]

Bulk update Entity Store entities.

PUT /api/security/entity_store/entities/bulk. Updates (upserts) multiple entity documents in a single request.

Parameters:
  • entities (list[dict[str, Any]]) – The entities to update. Each entry requires type ("user", "host", "service" or "generic") and doc (the entity document, as accepted by update_entity()). Unlike create_entity(), bulk updates do not create missing documents (even with force): those rows are reported in errors as 404 document_missing_exception items.

  • force (bool | None) – If True, force the updates. Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool) and per-entity errors.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.bulk_update_entities(
...     entities=[
...         {"type": "host", "doc": {"host": {"name": "web-01"}}},
...         {"type": "user", "doc": {"user": {"name": "alice"}}},
...     ],
...     force=True,
... )
>>> print(result.body["ok"], result.body["errors"])
True []
delete_entity(*, entity_id, space_id=None, validate_spaces=None)[source]

Delete an Entity Store entity.

DELETE /api/security/entity_store/entities/. Deletes an entity document from the Entity Store by its EUID.

Parameters:
  • entity_id (str) – The entity unique ID (EUID) of the entity to delete, e.g. "host:web-01".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.delete_entity(
...     entity_id="host:web-01"
... )
>>> print(result.body["deleted"])
True
get_entity_resolution_group(*, entity_id, space_id=None, validate_spaces=None)[source]

Get the resolution group of an entity.

GET /api/security/entity_store/resolution/group. Returns the resolution group for an entity: the target (canonical) entity and the alias entities linked to it.

Parameters:
  • entity_id (str) – The entity unique ID (EUID) of the entity, e.g. "host:web-01".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with target (the canonical entity document), aliases (linked entities) and group_size.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> group = client.entity_analytics.get_entity_resolution_group(
...     entity_id="host:web-01"
... )
>>> print(group.body["group_size"])

Link entities to a target entity (entity resolution).

POST /api/security/entity_store/resolution/link. Marks the given entities as aliases of the target entity, merging them into one resolution group.

Parameters:
  • entity_ids (list[str]) – The EUIDs of the entities to link as aliases.

  • target_id (str) – The EUID of the target (canonical) entity.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with linked, skipped and target_id.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.link_entities(
...     entity_ids=["host:web-01.internal"],
...     target_id="host:web-01",
... )
>>> print(result.body["linked"])
['host:web-01.internal']

Unlink entities from their resolution group.

POST /api/security/entity_store/resolution/unlink. Removes the alias links of the given entities, splitting them out of their resolution group.

Parameters:
  • entity_ids (list[str]) – The EUIDs of the entities to unlink.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with unlinked and skipped.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = client.entity_analytics.unlink_entities(
...     entity_ids=["host:web-01.internal"]
... )
>>> print(result.body["unlinked"])
['host:web-01.internal']
perform_request(method, path, *, params=None, headers=None, body=None)

Perform an HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]

AsyncEntityAnalyticsClient

Asynchronous version of the EntityAnalyticsClient for use with async/await syntax.

class kibana._async.client.entity_analytics.AsyncEntityAnalyticsClient(client, default_space_id=None, validate_spaces=True)[source]

Bases: AsyncNamespaceClient

Async client for the Kibana Security Entity Analytics API.

Entity Analytics surfaces risk and privilege insights for entities (hosts, users, services and generic entities) observed by the Elastic Security solution. This client covers the Kibana 9.4.3 Entity Analytics REST APIs:

  • Asset criticality (/api/asset_criticality): classify how critical an entity is (deprecated in 9.4 in favor of the Entity Store).

  • Risk engine (/api/risk_score/engine): schedule, configure and clean up the risk scoring engine.

  • Privilege monitoring (/api/entity_analytics/monitoring): manage the Privilege Monitoring Engine and monitored privileged users, including CSV bulk upload.

  • Privileged access detection (.../privileged_user_monitoring/pad): install and inspect the PAD ML package.

  • Watchlists (/api/entity_analytics/watchlists): group entities and apply risk modifiers (Technical Preview in 9.4).

  • Entity Store (/api/security/entity_store): install, manage and query the entity store, including direct entity CRUD and entity resolution (linking).

All Entity Analytics resources are space-scoped: every method accepts an optional space_id to target a specific space (None targets the default space or the space the client is scoped to).

Example

>>> from kibana import AsyncKibana
>>> client = AsyncKibana("http://localhost:5601", api_key="...")
>>>
>>> # Classify an asset and read it back
>>> await client.entity_analytics.create_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     criticality_level="high_impact",
... )
>>> record = await client.entity_analytics.get_asset_criticality(
...     id_field="host.name", id_value="my-host"
... )
>>>
>>> # Install the Entity Store and check its status
>>> await client.entity_analytics.install_entity_store(entity_types=["host"])
>>> status = await client.entity_analytics.get_entity_store_status()
>>> print(status.body["status"])

Usage

The AsyncEntityAnalyticsClient provides the same methods as EntityAnalyticsClient but all methods are async and must be awaited:

import asyncio

from kibana import AsyncKibana

async def main():
    async with AsyncKibana("http://localhost:5601") as client:
        # Classify an asset (async)
        await client.entity_analytics.create_asset_criticality(
            id_field="host.name",
            id_value="web-01",
            criticality_level="high_impact",
        )

        # Check the Entity Store (async)
        status = await client.entity_analytics.get_entity_store_status()
        print(status.body["status"])

        # Clean up (async)
        await client.entity_analytics.delete_asset_criticality(
            id_field="host.name", id_value="web-01"
        )

asyncio.run(main())
__init__(client, default_space_id=None, validate_spaces=True)[source]

Initialize the AsyncEntityAnalyticsClient.

Parameters:
  • client (AsyncKibana) – The parent AsyncKibana client instance to delegate requests to.

  • default_space_id (str | None) – Optional default space ID for all operations.

  • validate_spaces (bool) – Whether to validate space existence before space-scoped operations (default: True).

Example

>>> entity_analytics_client = AsyncEntityAnalyticsClient(kibana_client)
async create_asset_criticality(*, id_field, id_value, criticality_level, refresh=None, space_id=None, validate_spaces=None)[source]

Upsert an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead (e.g. update_entity()).

POST /api/asset_criticality. Creates or updates (upserts) the asset criticality record for the given entity. If a record already exists for the specified entity, that record is overwritten. If no record exists, a new record is created.

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity (e.g. the host name).

  • criticality_level (str) – The criticality level. One of "low_impact", "medium_impact", "high_impact", "extreme_impact".

  • refresh (str | None) – If "wait_for", wait for a refresh so the created record is visible to subsequent searches.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created/updated record (id_field, id_value, criticality_level, @timestamp, asset and the entity field object).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> record = await client.entity_analytics.create_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     criticality_level="high_impact",
...     refresh="wait_for",
... )
>>> print(record.body["criticality_level"])
high_impact
async get_asset_criticality(*, id_field, id_value, space_id=None, validate_spaces=None)[source]

Get an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

GET /api/asset_criticality. Gets the asset criticality record for the given entity.

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the asset criticality record.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> record = await client.entity_analytics.get_asset_criticality(
...     id_field="host.name", id_value="my-host"
... )
>>> print(record.body["criticality_level"])
async delete_asset_criticality(*, id_field, id_value, refresh=None, space_id=None, validate_spaces=None)[source]

Delete an asset criticality record.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

DELETE /api/asset_criticality. Deletes the asset criticality record for the given entity. If no record exists, the response reports deleted: false (no error is raised).

Parameters:
  • id_field (str) – The field representing the entity identifier. One of "host.name", "user.name", "service.name", "entity.id".

  • id_value (str) – The identifier of the entity.

  • refresh (str | None) – If "wait_for", wait for a refresh so the deletion is visible to subsequent searches.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool) and, if a record was deleted, the deleted record.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.delete_asset_criticality(
...     id_field="host.name",
...     id_value="my-host",
...     refresh="wait_for",
... )
>>> print(result.body["deleted"])
True
async bulk_upsert_asset_criticality(*, records, space_id=None, validate_spaces=None)[source]

Bulk upsert asset criticality records.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

POST /api/asset_criticality/bulk. Bulk creates or updates (up to 1000) asset criticality records. If a record already exists for the specified entity, that record is overwritten. In addition to the regular criticality levels, bulk upload accepts the special "unassigned" level, which removes the record’s criticality assignment.

Parameters:
  • records (list[dict[str, Any]]) – Records to upsert. Each record requires id_field (one of "host.name", "user.name", "service.name", "entity.id"), id_value and criticality_level ("low_impact", "medium_impact", "high_impact", "extreme_impact" or "unassigned").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with errors (per-record failures, with the record index) and stats (successful/failed/total).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.bulk_upsert_asset_criticality(
...     records=[
...         {
...             "id_field": "host.name",
...             "id_value": "my-host",
...             "criticality_level": "high_impact",
...         },
...         {
...             "id_field": "user.name",
...             "id_value": "my-user",
...             "criticality_level": "low_impact",
...         },
...     ]
... )
>>> print(result.body["stats"]["successful"])
2
async find_asset_criticality(*, sort_field=None, sort_direction=None, page=None, per_page=None, kuery=None, space_id=None, validate_spaces=None)[source]

List asset criticality records.

Deprecated since version 9.4: The asset criticality APIs are deprecated; manage asset criticality through the Entity Store entity APIs instead.

GET /api/asset_criticality/list. Lists asset criticality records, paging, sorting and filtering as needed.

Parameters:
  • sort_field (str | None) – The field to sort by. One of "id_value", "id_field", "criticality_level", "@timestamp".

  • sort_direction (str | None) – The order to sort by: "asc" or "desc".

  • page (int | None) – The page number to return (>= 1).

  • per_page (int | None) – The number of records to return per page (1-1000).

  • kuery (str | None) – A KQL string to filter the records (e.g. 'host.name: my-host').

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with records, total, page and per_page.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> found = await client.entity_analytics.find_asset_criticality(
...     kuery="criticality_level: high_impact",
...     sort_field="@timestamp",
...     sort_direction="desc",
...     per_page=100,
... )
>>> print(found.body["total"])
async schedule_risk_engine_now(*, space_id=None, validate_spaces=None)[source]

Run the risk scoring engine immediately.

POST /api/risk_score/engine/schedule_now. Schedules the risk scoring engine to run as soon as possible. Use this to recalculate entity risk scores after updating the risk engine configuration.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with success (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.schedule_risk_engine_now()
>>> print(result.body["success"])
async configure_risk_engine_saved_object(*, enable_reset_to_zero=None, exclude_alert_statuses=None, exclude_alert_tags=None, filters=None, page_size=None, range=None, space_id=None, validate_spaces=None)[source]

Configure the risk engine saved object.

PATCH /api/risk_score/engine/saved_object/configure. Configures the risk engine saved object with new settings such as the alert date range, excluded alert statuses/tags and entity filters.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • enable_reset_to_zero (bool | None) – Whether risk scores of entities without recent alerts are reset to zero.

  • exclude_alert_statuses (list[str] | None) – Alert workflow statuses to exclude from risk scoring (e.g. ["closed"]).

  • exclude_alert_tags (list[str] | None) – Alert tags to exclude from risk scoring.

  • filters (list[dict[str, Any]] | None) – Entity filters. Each filter requires entity_types (list of "host"/"user"/"service") and filter (a KQL string).

  • page_size (int | None) – Number of entities to score per page (100-10000).

  • range (dict[str, str] | None) – The alert date range to consider, an object with start and end date-math strings (e.g. {"start": "now-30d", "end": "now"}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with risk_engine_saved_object_configured (bool) on success.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> await client.entity_analytics.configure_risk_engine_saved_object(
...     range={"start": "now-30d", "end": "now"},
...     exclude_alert_statuses=["closed"],
... )
async cleanup_risk_engine(*, space_id=None, validate_spaces=None)[source]

Clean up the risk engine, deleting all risk scoring data.

DELETE /api/risk_score/engine/dangerously_delete_data. Permanently cleans up the risk engine by deleting the risk scoring task, removing risk score transforms and deleting all risk score data and indices. This operation destroys data and cannot be undone.

Note: on Kibana deployments where Entity Store V2 is enabled, the legacy risk engine routes are not registered and this endpoint returns a plain 404 (NotFoundError).

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with risk_engine_cleanup (bool); on partial failure the body contains a cleanup_agent_policies / errors task failure payload.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.cleanup_risk_engine()
async init_monitoring_engine(*, space_id=None, validate_spaces=None)[source]

Initialize the Privilege Monitoring Engine.

POST /api/entity_analytics/monitoring/engine/init. Initializes the Privilege Monitoring Engine for the space, creating the monitored-users index and the monitoring task. The call is idempotent: initializing an already-started engine succeeds.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with the engine status (e.g. "started") and, on failure, an error object.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.init_monitoring_engine()
>>> print(result.body["status"])
started
async disable_monitoring_engine(*, space_id=None, validate_spaces=None)[source]

Disable the Privilege Monitoring Engine.

POST /api/entity_analytics/monitoring/engine/disable. Disables the Privilege Monitoring Engine without deleting its data. Use init_monitoring_engine() to re-enable it.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with the engine status (e.g. "disabled") and, on failure, an error object.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.disable_monitoring_engine()
>>> print(result.body["status"])
disabled
async schedule_monitoring_engine_now(*, space_id=None, validate_spaces=None)[source]

Run the Privilege Monitoring Engine immediately.

POST /api/entity_analytics/monitoring/engine/schedule_now. Schedules the Privilege Monitoring Engine task to run as soon as possible instead of waiting for its next scheduled run.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with success (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.schedule_monitoring_engine_now()
>>> print(result.body["success"])
True
async delete_monitoring_engine(*, data=None, space_id=None, validate_spaces=None)[source]

Delete the Privilege Monitoring Engine.

DELETE /api/entity_analytics/monitoring/engine/delete. Deletes the Privilege Monitoring Engine, removing its task and saved object.

Parameters:
  • data (bool | None) – If True, also delete the engine’s data (the monitored users index). Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.delete_monitoring_engine(data=True)
>>> print(result.body["deleted"])
True
async get_monitoring_health(*, space_id=None, validate_spaces=None)[source]

Get the health of the Privilege Monitoring Engine.

GET /api/entity_analytics/monitoring/privileges/health. Runs a health check on privilege monitoring and returns the engine status for the space.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with status (e.g. "not_installed", "started", "disabled"), a users count summary when installed, and an error object on engine failure.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> health = await client.entity_analytics.get_monitoring_health()
>>> print(health.body["status"])
async get_monitoring_privileges(*, space_id=None, validate_spaces=None)[source]

Check the current user’s privilege-monitoring privileges.

GET /api/entity_analytics/monitoring/privileges/privileges. Runs a privileges check for privilege monitoring, reporting which Elasticsearch index privileges the current user holds.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with privileges (per-index privilege flags) and has_all_required (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.get_monitoring_privileges()
>>> print(result.body["has_all_required"])
async create_monitored_user(*, name, monitoring_labels=None, space_id=None, validate_spaces=None)[source]

Create a new monitored (privileged) user.

POST /api/entity_analytics/monitoring/users. Adds a user to privileged user monitoring. The user is marked as privileged with source "api".

Parameters:
  • name (str) – The name of the user to monitor.

  • monitoring_labels (list[dict[str, Any]] | None) – Optional labels to associate with the user. Each label object supports field, value and source (one of "api", "csv", "index_sync").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created monitored-user document (id, user, labels, entity_analytics_monitoring, @timestamp).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> user = await client.entity_analytics.create_monitored_user(
...     name="admin-user"
... )
>>> print(user.body["user"]["is_privileged"])
True
async update_monitored_user(*, id, doc, space_id=None, validate_spaces=None)[source]

Update a monitored user.

PUT /api/entity_analytics/monitoring/users/{id}. Applies a partial update to a monitored-user document.

Parameters:
  • id (str) – The ID of the monitored-user document to update.

  • doc (dict[str, Any]) – The partial monitored-user document to apply. Supports user ({"name": ..., "is_privileged": ...}), labels ({"sources": [...], "source_ids": [...], "source_integrations": [...]}) and entity_analytics_monitoring ({"labels": [...]}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the updated monitored-user document.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = await client.entity_analytics.update_monitored_user(
...     id="OflsOZ8BiXLbCmmNbJ9J",
...     doc={"user": {"name": "admin-user", "is_privileged": True}},
... )
>>> print(updated.body["user"]["name"])
admin-user
async delete_monitored_user(*, id, space_id=None, validate_spaces=None)[source]

Delete a monitored user.

DELETE /api/entity_analytics/monitoring/users/{id}. Removes a user from privileged user monitoring.

Parameters:
  • id (str) – The ID of the monitored-user document to delete.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with acknowledged (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.delete_monitored_user(
...     id="OflsOZ8BiXLbCmmNbJ9J"
... )
>>> print(result.body["acknowledged"])
True
async list_monitored_users(*, kql=None, space_id=None, validate_spaces=None)[source]

List monitored (privileged) users.

GET /api/entity_analytics/monitoring/users/list. Lists all monitored users in the space, optionally filtered with KQL.

Parameters:
  • kql (str | None) – KQL query to filter the monitored users (e.g. 'user.name: admin*').

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse whose body is a list of monitored-user documents.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> users = await client.entity_analytics.list_monitored_users(
...     kql="user.name: admin*"
... )
>>> for user in users.body:
...     print(user["user"]["name"])
async upload_monitored_users_csv(*, file, filename='users.csv', space_id=None, validate_spaces=None)[source]

Bulk upsert monitored users via CSV upload.

POST /api/entity_analytics/monitoring/users/_csv. Uploads a CSV file (as multipart/form-data) containing one user name per line to add or update multiple monitored users at once.

Parameters:
  • file (bytes | str) – The CSV content as bytes or str (one user name per line).

  • filename (str) – Filename advertised in the multipart upload.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with errors and stats (successfulOperations/failedOperations/uploaded/ totalOperations).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.upload_monitored_users_csv(
...     file="admin-1\nadmin-2\n"
... )
>>> print(result.body["stats"]["uploaded"])
2
async install_pad_package(*, space_id=None, validate_spaces=None)[source]

Install the privileged access detection (PAD) package.

POST /api/entity_analytics/privileged_user_monitoring/pad/install. Installs the privileged access detection integration package, which provides machine-learning jobs for detecting anomalous privileged activity. The call is idempotent.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with a confirmation message.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.install_pad_package()
>>> print(result.body["message"])
Successfully installed privileged access detection package.
async get_pad_status(*, space_id=None, validate_spaces=None)[source]

Get the status of the privileged access detection (PAD) package.

GET /api/entity_analytics/privileged_user_monitoring/pad/status. Reports whether the PAD integration package is installed, whether its ML module has been set up, and the state of its ML jobs.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with package_installation_status ("complete"/"incomplete"), ml_module_setup_status and jobs (per-job state).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> status = await client.entity_analytics.get_pad_status()
>>> print(status.body["package_installation_status"])
async create_watchlist(*, name, risk_modifier, description=None, managed=None, entity_sources=None, space_id=None, validate_spaces=None)[source]

Create a new watchlist.

Technical preview in 9.4. POST /api/entity_analytics/watchlists. Creates a watchlist that groups entities and applies a risk score modifier to them, optionally creating and linking entity sources.

Parameters:
  • name (str) – Unique name for the watchlist.

  • risk_modifier (float) – Risk score modifier associated with the watchlist (0-2).

  • description (str | None) – Description of the watchlist.

  • managed (bool | None) – Whether the watchlist is managed by the system.

  • entity_sources (list[dict[str, Any]] | None) – Optional entity sources to create and link to the watchlist. Each source requires type (one of "index", "entity_analytics_integration", "store") and name, and supports enabled, indexPattern, identifierField, integrationName, matchers, filter, queryRule and range.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the created watchlist (id, name, riskModifier, entitySourceIds, createdAt, updatedAt).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlist = await client.entity_analytics.create_watchlist(
...     name="High Risk Vendors",
...     risk_modifier=1.5,
...     description="High risk vendor watchlist",
... )
>>> print(watchlist.body["id"])
async list_watchlists(*, space_id=None, validate_spaces=None)[source]

List all watchlists.

Technical preview in 9.4. GET /api/entity_analytics/watchlists/list. Lists all watchlists in the space.

Parameters:
  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse whose body is a list of watchlists.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlists = await client.entity_analytics.list_watchlists()
>>> for watchlist in watchlists.body:
...     print(watchlist["name"], watchlist["riskModifier"])
async get_watchlist(*, id, space_id=None, validate_spaces=None)[source]

Get a watchlist by ID.

Technical preview in 9.4. GET /api/entity_analytics/watchlists/{id}.

Parameters:
  • id (str) – The ID of the watchlist.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the watchlist (id, name, riskModifier, entitySourceIds, entityCount, …).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> watchlist = await client.entity_analytics.get_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8"
... )
>>> print(watchlist.body["name"])
async update_watchlist(*, id, name, risk_modifier, description=None, managed=None, space_id=None, validate_spaces=None)[source]

Update an existing watchlist.

Technical preview in 9.4. PUT /api/entity_analytics/watchlists/{id}. Updates a watchlist’s name, description, risk modifier or managed flag. name and risk_modifier are required by the API even when unchanged.

Parameters:
  • id (str) – The ID of the watchlist to update.

  • name (str) – Unique name for the watchlist.

  • risk_modifier (float) – Risk score modifier associated with the watchlist (0-2).

  • description (str | None) – Description of the watchlist.

  • managed (bool | None) – Whether the watchlist is managed by the system.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse containing the updated watchlist.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> updated = await client.entity_analytics.update_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     name="High Risk Vendors",
...     risk_modifier=1.8,
... )
>>> print(updated.body["riskModifier"])
1.8
async delete_watchlist(*, id, space_id=None, validate_spaces=None)[source]

Delete a watchlist by ID.

Technical preview in 9.4. DELETE /api/entity_analytics/watchlists/{id}. Deletes a watchlist. This route is supported by Kibana 9.4.3 but is not documented in its OpenAPI specification.

Parameters:
  • id (str) – The ID of the watchlist to delete.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.delete_watchlist(
...     id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8"
... )
>>> print(result.body["deleted"])
True
async upload_watchlist_csv(*, watchlist_id, file, filename='watchlist.csv', space_id=None, validate_spaces=None)[source]

Upload a CSV file to add entities to a watchlist.

Technical preview in 9.4. POST /api/entity_analytics/watchlists/{watchlist_id}/csv_upload. Uploads a CSV file (as multipart/form-data) whose rows identify entities to add to the watchlist. The CSV requires a header row that includes a type column (e.g. type,name); entities are matched against the Entity Store, which must be installed.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • file (bytes | str) – The CSV content as bytes or str, including the header row (e.g. "type,name\nuser,alice\n").

  • filename (str) – Filename advertised in the multipart upload.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with total, successful, failed, unmatched and per-row items.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.upload_watchlist_csv(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     file="type,name\nuser,alice\nhost,web-01\n",
... )
>>> print(result.body["successful"])
async assign_watchlist_entities(*, watchlist_id, euids, space_id=None, validate_spaces=None)[source]

Manually assign entities to a watchlist.

Technical preview in 9.4 (added in 9.4.0). POST /api/entity_analytics/watchlists/{watchlist_id}/entities/assign. Assigns Entity Store entities (by EUID) to the watchlist. The Entity Store must be installed.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • euids (list[str]) – The entity unique IDs (EUIDs) to assign, e.g. ["host:web-01"].

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with successful, failed, not_found, total and per-entity items.

Raises:
  • NotFoundError – If the watchlist does not exist or the Entity Store indices are missing.

  • ApiError – Kibana 9.4.3 answers 500 "Unexpected entity store     record" when the entity was created through the entity CRUD APIs and has not been materialized by the Entity Store transform.

  • AuthenticationException – If authentication fails.

  • AuthorizationException – If insufficient privileges.

  • SpaceNotFoundError – If the space doesn’t exist and validation is enabled.

Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.assign_watchlist_entities(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     euids=["host:web-01"],
... )
>>> print(result.body["successful"])
async unassign_watchlist_entities(*, watchlist_id, euids, space_id=None, validate_spaces=None)[source]

Manually unassign entities from a watchlist.

Technical preview in 9.4 (added in 9.4.0). POST /api/entity_analytics/watchlists/{watchlist_id}/entities/unassign. Removes manually-assigned Entity Store entities (by EUID) from the watchlist.

Parameters:
  • watchlist_id (str) – The ID of the watchlist.

  • euids (list[str]) – The entity unique IDs (EUIDs) to unassign.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with successful, failed, not_found, total and per-entity items.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.unassign_watchlist_entities(
...     watchlist_id="b8b48d31-3026-45c0-aa8a-b8ed7f86ade8",
...     euids=["host:web-01"],
... )
>>> print(result.body["successful"])
async install_entity_store(*, entity_types=None, log_extraction=None, history_snapshot=None, space_id=None, validate_spaces=None)[source]

Install the Entity Store.

POST /api/security/entity_store/install. Installs the Entity Store for the space, creating the entity indices, transforms and extraction tasks for the requested entity types.

Parameters:
  • entity_types (list[str] | None) – The entity types to install engines for, from "user", "host", "service", "generic". Defaults to all types on the server.

  • log_extraction (dict[str, Any] | None) – Log extraction settings. Supports frequency, lookbackPeriod, delay, fieldHistoryLength, filter, additionalIndexPatterns, excludedIndexPatterns, docsLimit, maxLogsPerPage, maxLogsPerWindow, maxLogsPerWindowCapBehavior ("defer"/"drop") and maxTimeWindowSize.

  • history_snapshot (dict[str, Any] | None) – History snapshot settings ({"frequency": "24h"}).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.install_entity_store(
...     entity_types=["host"],
...     log_extraction={"frequency": "5m", "lookbackPeriod": "12h"},
... )
>>> print(result.body["ok"])
True
async uninstall_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Uninstall the Entity Store.

POST /api/security/entity_store/uninstall. Uninstalls Entity Store engines, removing their transforms, tasks and indices. When entity_types is omitted, all engines are uninstalled.

Parameters:
  • entity_types (list[str] | None) – The entity types to uninstall engines for, from "user", "host", "service", "generic". Defaults to all installed types.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.uninstall_entity_store()
>>> print(result.body["ok"])
True
async update_entity_store(*, log_extraction, space_id=None, validate_spaces=None)[source]

Update the Entity Store configuration.

PUT /api/security/entity_store. Updates the log extraction configuration of the installed Entity Store.

Parameters:
  • log_extraction (dict[str, Any]) – The log extraction settings to update. Supports the same keys as install_entity_store() (frequency, lookbackPeriod, delay, fieldHistoryLength, filter, additionalIndexPatterns, excludedIndexPatterns, docsLimit, maxLogsPerPage, maxLogsPerWindow, maxLogsPerWindowCapBehavior, maxTimeWindowSize).

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.update_entity_store(
...     log_extraction={"frequency": "10m", "lookbackPeriod": "6h"}
... )
>>> print(result.body["ok"])
True
async get_entity_store_status(*, include_components=None, space_id=None, validate_spaces=None)[source]

Get the status of the Entity Store.

GET /api/security/entity_store/status. Returns the overall Entity Store status ("not_installed", "installing", "running", "stopped" or "error") and the status of each engine.

Parameters:
  • include_components (bool | None) – If True, include the status of the Entity Store’s underlying components (transforms, index templates, indices, tasks, …) for each engine.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with status and engines (per-engine type, status and configuration; plus components when requested).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> status = await client.entity_analytics.get_entity_store_status(
...     include_components=True
... )
>>> print(status.body["status"])
running
async start_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Start Entity Store engines.

PUT /api/security/entity_store/start. Starts (resumes) the installed Entity Store engines. When entity_types is omitted, all installed engines are started.

Parameters:
  • entity_types (list[str] | None) – The entity types whose engines to start, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.start_entity_store()
>>> print(result.body["ok"])
True
async stop_entity_store(*, entity_types=None, space_id=None, validate_spaces=None)[source]

Stop Entity Store engines.

PUT /api/security/entity_store/stop. Stops (pauses) the installed Entity Store engines without uninstalling them. When entity_types is omitted, all installed engines are stopped.

Parameters:
  • entity_types (list[str] | None) – The entity types whose engines to stop, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.stop_entity_store()
>>> print(result.body["ok"])
True
async list_entities(*, filter=None, size=None, search_after=None, source=None, fields=None, sort_field=None, sort_order=None, page=None, per_page=None, filter_query=None, entity_types=None, space_id=None, validate_spaces=None)[source]

List Entity Store entities.

GET /api/security/entity_store/entities. Lists entities stored in the Entity Store, with paging, sorting and filtering.

Parameters:
  • filter (str | None) – An ES query-string filter (e.g. 'host.name: "web-01"').

  • size (int | None) – Maximum number of entities to return (cursor-style pagination, used with search_after).

  • search_after (str | None) – Cursor returned by a previous call, to fetch the next batch of results.

  • source (list[str] | None) – Index patterns to search for entities.

  • fields (list[str] | None) – Restrict the entity fields returned.

  • sort_field (str | None) – The field to sort by.

  • sort_order (str | None) – The sort order: "asc" or "desc".

  • page (int | None) – The page number to return (page-style pagination).

  • per_page (int | None) – The number of entities per page (up to 10000).

  • filter_query (str | None) – An additional filter as a JSON DSL query string.

  • entity_types (list[str] | None) – Restrict results to these entity types, from "user", "host", "service", "generic".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with records, total, page, per_page and an inspect object with the executed query.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> entities = await client.entity_analytics.list_entities(
...     entity_types=["host"],
...     sort_field="entity.name",
...     sort_order="asc",
...     per_page=100,
... )
>>> print(entities.body["total"])
async create_entity(*, entity_type, document, space_id=None, validate_spaces=None)[source]

Create an Entity Store entity.

POST /api/security/entity_store/entities/{entityType}. Creates an entity document directly in the Entity Store. The Entity Store must be installed for the given entity type.

Parameters:
  • entity_type (str) – The entity type: "user", "host", "service" or "generic".

  • document (dict[str, Any]) – The entity document. Must contain the type’s identity field (e.g. {"host": {"name": "web-01"}} for hosts) and supports entity, asset, labels, tags, event and @timestamp. If entity.id is provided it must match the EUID the server generates (e.g. "host:web-01").

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.create_entity(
...     entity_type="host",
...     document={"host": {"name": "web-01"}},
... )
>>> print(result.body["ok"])
True
async update_entity(*, entity_type, document, force=None, space_id=None, validate_spaces=None)[source]

Update an Entity Store entity.

PUT /api/security/entity_store/entities/{entityType}. Updates (upserts) an entity document in the Entity Store.

Parameters:
  • entity_type (str) – The entity type: "user", "host", "service" or "generic".

  • document (dict[str, Any]) – The entity document to apply. Must contain the type’s identity field (e.g. {"host": {"name": "web-01"}}).

  • force (bool | None) – If True, force the update even when the entity does not already exist. Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.update_entity(
...     entity_type="host",
...     document={
...         "host": {"name": "web-01"},
...         "labels": {"env": "prod"},
...     },
...     force=True,
... )
>>> print(result.body["ok"])
True
async bulk_update_entities(*, entities, force=None, space_id=None, validate_spaces=None)[source]

Bulk update Entity Store entities.

PUT /api/security/entity_store/entities/bulk. Updates (upserts) multiple entity documents in a single request.

Parameters:
  • entities (list[dict[str, Any]]) – The entities to update. Each entry requires type ("user", "host", "service" or "generic") and doc (the entity document, as accepted by update_entity()). Unlike create_entity(), bulk updates do not create missing documents (even with force): those rows are reported in errors as 404 document_missing_exception items.

  • force (bool | None) – If True, force the updates. Defaults to False on the server.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with ok (bool) and per-entity errors.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.bulk_update_entities(
...     entities=[
...         {"type": "host", "doc": {"host": {"name": "web-01"}}},
...         {"type": "user", "doc": {"user": {"name": "alice"}}},
...     ],
...     force=True,
... )
>>> print(result.body["ok"], result.body["errors"])
True []
async delete_entity(*, entity_id, space_id=None, validate_spaces=None)[source]

Delete an Entity Store entity.

DELETE /api/security/entity_store/entities/. Deletes an entity document from the Entity Store by its EUID.

Parameters:
  • entity_id (str) – The entity unique ID (EUID) of the entity to delete, e.g. "host:web-01".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with deleted (bool).

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.delete_entity(
...     entity_id="host:web-01"
... )
>>> print(result.body["deleted"])
True
async get_entity_resolution_group(*, entity_id, space_id=None, validate_spaces=None)[source]

Get the resolution group of an entity.

GET /api/security/entity_store/resolution/group. Returns the resolution group for an entity: the target (canonical) entity and the alias entities linked to it.

Parameters:
  • entity_id (str) – The entity unique ID (EUID) of the entity, e.g. "host:web-01".

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with target (the canonical entity document), aliases (linked entities) and group_size.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> group = await client.entity_analytics.get_entity_resolution_group(
...     entity_id="host:web-01"
... )
>>> print(group.body["group_size"])

Link entities to a target entity (entity resolution).

POST /api/security/entity_store/resolution/link. Marks the given entities as aliases of the target entity, merging them into one resolution group.

Parameters:
  • entity_ids (list[str]) – The EUIDs of the entities to link as aliases.

  • target_id (str) – The EUID of the target (canonical) entity.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with linked, skipped and target_id.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.link_entities(
...     entity_ids=["host:web-01.internal"],
...     target_id="host:web-01",
... )
>>> print(result.body["linked"])
['host:web-01.internal']

Unlink entities from their resolution group.

POST /api/security/entity_store/resolution/unlink. Removes the alias links of the given entities, splitting them out of their resolution group.

Parameters:
  • entity_ids (list[str]) – The EUIDs of the entities to unlink.

  • space_id (str | None) – Optional space ID for space-scoped operations.

  • validate_spaces (bool | None) – Override space validation setting for this operation.

Returns:

ObjectApiResponse with unlinked and skipped.

Raises:
Return type:

ObjectApiResponse[Any]

Example

>>> result = await client.entity_analytics.unlink_entities(
...     entity_ids=["host:web-01.internal"]
... )
>>> print(result.body["unlinked"])
['host:web-01.internal']
async perform_request(method, path, *, params=None, headers=None, body=None)

Perform an async HTTP request via the parent client with space context enhancement.

Parameters:
  • method (str) – HTTP method (GET, POST, PUT, DELETE, etc.)

  • path (str) – API endpoint path

  • params (dict[str, Any] | None) – Query parameters

  • headers (dict[str, str] | None) – Request headers

  • body (dict[str, Any] | None) – Request body

Returns:

API response

Raises:

ApiError – If the API returns an error response (enhanced with space context)

Return type:

ObjectApiResponse[Any]