How-to guide

Manage Elasticsearch indices

How OpenCTI organizes its Elasticsearch or OpenSearch indices, the rollover policy that keeps their shards small, and the permissions its user needs.

OpenCTIFor platform engineers

OpenCTI stores its knowledge in about fifteen Elasticsearch or OpenSearch indices and rolls them over so that no shard grows too big. This page says which indices exist, which policy rolls them over and how to change it, how to check that it works, and which permissions the OpenCTI user needs on a secured cluster.

OPENCTINAMESINDEX GENERATIONSOpenCTIWrites and reads its indicesopencti_historyWrite aliasopencti_history-*Reads all generationsopencti-ilm-policy50 GB primary shard or 75,000,000documentsopencti_history-000001Created at the first startopencti_history-000002Created at rollover
  1. OpenCTI → opencti_history: writes
  2. OpenCTI → opencti_history-*: reads
  3. opencti_history → opencti_history-000001: before rollover
  4. opencti_history → opencti_history-000002: after rollover
  5. opencti_history-* → opencti_history-000001
  6. opencti_history-* → opencti_history-000002
  7. opencti-ilm-policy → opencti_history-000002: creates
OpenCTI writes through an alias that the lifecycle policy moves to a new index generation, and reads every generation with a wildcard

How OpenCTI uses its indices

OpenCTI writes to each index through an alias, and reads all its generations with a wildcard. At the first start, it creates each index with the suffix -000001 (elasticsearch:index_creation_pattern), for example opencti_history-000001, and a lifecycle policy:

EnginePolicyRolls over when
Elasticsearchopencti-ilm-policy, index lifecycle management (ILM)A primary shard reaches 50 GB, or the index reaches 75,000,000 documents
OpenSearchopencti-ism-policy, index state management (ISM)The same thresholds

At rollover, the engine creates the next generation, -000002, and moves the write alias to it. The opencti prefix is elasticsearch:index_prefix.

The indices are:

opencti_deleted_objects, opencti_draft_objects, opencti_files, opencti_history, opencti_inferred_entities, opencti_inferred_relationships, opencti_internal_objects, opencti_internal_relationships, opencti_stix_core_relationships, opencti_stix_cyber_observable_relationships, opencti_stix_cyber_observables, opencti_stix_domain_objects, opencti_stix_meta_objects, opencti_stix_meta_relationships, opencti_stix_sighting_relationships.

Four of them usually grow fastest:

IndexHolds
opencti_stix_meta_relationshipsThe links between objects and their labels, markings, external references and authors
opencti_historyThe history of every object
opencti_stix_cyber_observablesThe observables
opencti_stix_core_relationshipsThe STIX relationships

Change the rollover thresholds

The thresholds are set in the OpenCTI configuration:

KeyEnvironment variableDefault
elasticsearch:max_primary_shard_sizeELASTICSEARCH__MAX_PRIMARY_SHARD_SIZE50gb
elasticsearch:max_docsELASTICSEARCH__MAX_DOCS75000000

OpenCTI writes the policy when it creates its indices, so set them before the first start. On OpenSearch, an existing opencti-ism-policy is never overwritten: to change the thresholds afterwards, edit the policy in OpenSearch.

Check the rollover

In xtm-docker, from the xtm-docker folder:

docker compose exec elasticsearch curl -s "http://localhost:9200/_cat/aliases/opencti_*?v&s=alias"
docker compose exec elasticsearch curl -s "http://localhost:9200/opencti_history-*/_ilm/explain?filter_path=indices.*.policy,indices.*.phase"
Check that it worked

The first command lists each alias, such as opencti_history, with its index generations. The second shows "policy":"opencti-ilm-policy" for every opencti_history index.

Permissions on a secured cluster

On a cluster with security on, the user OpenCTI connects with needs these permissions. They are given in the OpenSearch format.

  • On the indices that match opencti* (or your elasticsearch:index_prefix): indices_all.
  • On the cluster:
    • cluster_composite_ops_ro
    • cluster_manage_index_templates
    • cluster:admin/ingest/pipeline/put
    • cluster:admin/opendistro/ism/policy/write
    • cluster:monitor/health
    • cluster:monitor/main
    • cluster:monitor/state
    • cluster:monitor/task/get
    • indices:admin/index_template/put
    • indices:data/read/scroll/clear
    • indices:data/read/scroll
    • indices:data/write/bulk
Keep the indices permissions in the cluster permissions

The indices: permissions must also be in the cluster permissions, even if the index permissions already include them. Without them, OpenCTI can fail to start.

Platforms created before OpenCTI 5.9

A platform first started before OpenCTI 5.9 has no lifecycle policy on its indices. To add one:

  1. Upgrade the platform to the latest version.
  2. Check that the policy and the index templates exist after the migration.
  3. Split every shard larger than 50 GB into new indices, with the tools of your engine.
  4. Point the write alias to the latest index, and check that the policy runs.

Ask on the Filigran community Slack if you need help with this migration.

What's next

NextMonitor and troubleshoot XTM One
Deploy
Install, configure, secure, scale and upgrade the platform.

Published

Overview
Run the XTM platform locally
OverviewDeploy with an AI agent