Role in the platform
Both Elasticsearch and OpenSearch are supported. The platform driver auto-detects the variant.
Version compatibility
- Minimum: Elasticsearch 8.x or OpenSearch 2.x.
- Cluster sharing between environments is supported via index prefixes:
EVENTS_STORAGE_NAMESPACEfor the events store.ELASTIC_INDICES_PREFIXfor crawler and search engine.
Recommended deployment
Sizing: 3-node cluster, 16 GB RAM and 4 vCPU per node minimum, with dedicated master nodes for clusters > 5 data nodes.
Disk: start at ≥ 50 GB per node on a dev environment and ≥ 200 GB per node in production, then grow progressively based on actual usage and retention.
Helm Configuration
Configure your Elasticsearch or OpenSearch cluster credentials in both core & apps helm values :prismeai-crawler and prismeai-searchengine consume ELASTIC_INDICES_PREFIX to namespace their indices when sharing a cluster.
See Helm install for the full install context.
Least privileges
Cluster-level privileges
Only these are required:manage_ilmmanage_index_templatesmonitor
Index-level patterns
The user should only have access to these patterns:${eventsPrefix}-events-*${crawlerPrefix}-searchengine-webpages-*${aikPrefix}*
${eventsPrefix}corresponds to theEVENTS_STORAGE_NAMESPACEenvironment variable onprismeai-events.${crawlerPrefix}corresponds to theELASTIC_INDICES_PREFIXenvironment variable onprismeai-searchengineandprismeai-crawler.${aikPrefix}corresponds to thevector_store_index_prefixkey in the Storage workspace configuration (also visible in Govern > Infrastructure app).
all privilege can reasonably be granted on these three patterns, as the impact is necessarily limited to these three types of data.
Backup & restore
Snapshot API (recommended)
Register an S3 / Azure Blob / GCS snapshot repository, then snapshot regularly.Updates
- Check index mappings compatibility before a major upgrade.
- Some upgrades require reindexing — plan a maintenance window.
- For OpenSearch users, watch out for driver-specific differences around ILM and snapshot repositories.
Scaling
Index Lifecycle Management (ILM) Policies
Prismeai automatically configures ILM policies to automate index rollover + segments merging when their primary shard reach 40 GB, as recommended by Elasticsearch or OpenSearch. Our Elasticsearch driver also configures an ILM policy to automate the events deletion 30 days (default, configurable withEVENTS_SCHEDULED_DELETION_DAYS) after workspace deletion.
This is not yet supported by the Opensearch driver, which deletes events as soon as the workspace is deleted.
Events expiration is not configured from ILM as they do not offer the precision needed to tune different expiration periods depending on the different kind of data.
Instead, events expiration is enforced by prismeai-events /sys/cleanup/* APIs which are automatically called from a Kubernetes CronJob as described below.
Events automated cleanup
In addition to ILM, we provide a lightweight Kubernetes-native cleaner service that automatically:- Deletes expired events to enforce data retention regulation (i.e GDPR).
- Deletes datastreams from small & inactive workspaces to reduce shards usage and avoid reaching the 1000 shards per node limit.
- Removes
payloadandoutputfields fromruntime.automations.executedtechnical events to save disk space without compromising audit/debug capabilities in short term.
cleanup-es-indices Kubernetes CronJob scheduled every sunday at 0AM, while step 3 is executed from a cleanup-exec-events CronJob every night at 3:30AM.
Troubleshooting cleanup jobs
- Create a manual cleanup job from the existing CronJob:
- Check the job logs:
- Retrieve the task ID from the logs (e.g.
a3H0dnU3Sc2s66rwbmtCiQ:25814043above) and check its status with an Elasticsearch request:
- Key output fields:
- completed: Whether the cleanup task is still running or not. If it is, wait and regularly check its status again.
- task.running_time_in_nanos: Execution time.
- response.failures: Errors.
- response.total: Number of documents matching the query.
- response.updated: Number of documents updated by the query (removing all big data without removing the event itself to keep metadata).
- task.description: Request description.
Optimize index settings
- Scale your search cluster by adding more nodes and optimizing node roles. Configure dedicated master nodes for cluster management and data nodes for storage and search operations.
- Optimize index settings including primary shard count, replica count, and refresh intervals based on your data volume and query patterns.
- Implement Index Lifecycle Management (ILM) policies to automatically manage index aging, including hot, warm, cold, and delete phases.
- Retrieve your Knowledges (or other) index template configuration:
- Keep it, adjust existing configuration as needed and add the last template settings:
index.number_of_shards to 2 if you only have 2 nodes.
index.refresh_interval configures how often Elasticsearch will make your freshly written data available for search.
- Rollover your datastream in order to create a new index with the updated template:
Elasticsearch Self-Hosted Considerations
When running a self-hosted Elasticsearch or OpenSearch cluster, ensure nodes are distributed across different physical machines for proper redundancy. Use high-performance disks and monitor CPU iowait metrics to identify potential disk bottlenecks that could impact search performance. Pay attention to cluster health metrics and ensure adequate disk space for index growth and operations like merging and replication.Shard accounting
Elasticsearch limits each node to 1000 shards by default. A 3-node cluster can therefore hold at most 3000 shards. The events cleanup CronJob keeps this under control; if you approach the limit on a tenant you may need to consolidate older data streams or raise the per-node cap. In order to troubleshoot what patterns / apps consume the most shards, the api-gateway exposes a/sys/events/* route that returns the ES/OS _cat/shards as JSON. It is reserved to super admins (email in SUPER_ADMIN_EMAILS), and the gateway forwards to the events service sys/* APIs, so you can call it from outside the cluster:
?group=true to aggregate the shards by tenant (client) and by index-pattern family :
.ds-events, searchengine-webpages, aik_rag, type prefix). Optional query params:
patterns— comma-separated pattern templates (with%sas the tenant placeholder) to override the defaults above.tenants— comma-separated tenant list to force grouping (like theTENANTSvariable in the script) when auto-detection isn’t enough.index— restrict the underlying_cat/shardscall to a given index/pattern.
Move an Elasticsearch node without losing redundancy
When you need to migrate an Elasticsearch node to a different Kubernetes node without ever dropping below the original replica count (so shards keep two live copies at all times):- Provision the new Kubernetes node.
- Increase the Elasticsearch
nodeSet.replicasby one (e.g.kubectl -n <ns> edit elasticsearch/core). - Wait for shards to rebalance onto the new ES node (
GET /_cat/allocation/?v— relocating shards should drop to 0 for a few minutes). - Drain the Kubernetes node you want to retire (
kubectl drain node/<name>). The old ES pod terminates and shards relocate to the remaining nodes. - The StatefulSet will try to recreate the missing pod elsewhere — it will stay
Pendingbecause no node has the resources requested. - Decrease the Elasticsearch
nodeSet.replicasback to the original count. ThePendingpod is removed cleanly without disturbing the running ones. - Delete the drained Kubernetes node.
Operations & Troubleshooting
Volume formatting
When formatting the Elasticsearch or OpenSearch filesystem volume, it is important to first shutdown theprismeai-events microservice in core namespace. This can be easily done from Kubernetes by editing the deployment and setting replicas: 0.
Index mappings are initialized when prismeai-events starts up. If indexes and index mappings are deleted (such as when formatting a volume) without first stopping prismeai-events, the next event persistence request sent to the cluster would cause it to automatically infer an incorrect index mapping, which would cause most other persistence requests to fail and result in data loss. This is because when Prisme.ai events mapping are not initialized before first events write requests, ES/OS automatically infer mappings for payload.* nested fields, making it incompatible with the needed flattened (ES) / flat_object (OS) mapping on the entire payload field.
This situation causes errors like Limit of total fields [1000] has been exceeded as ES/OS tries to map every single payload.* nested field until reaching the 1000 fields maximum limit.
If it is possible to delete the events data (includes workspaces debug events and AIK usage metrics), this can be easily solved by:
- Shutting down
prismeai-eventsby editing the deployment and settingreplicas: 0. If a HorizontalPodAutoscaler exists forprismeai-events, first delete it or set its min/max replicas to 0. - Removing every failed index/datastream either from Kibana or curl:
_index field of prismeai-events error logs.
Names starting with .ds-events- are datastreams underlying indexes and can be renamed like this to delete all underlying indexes at once: .ds-events-<id>-000001 -> events-<id>
- Restarting
prismeai-eventsby editing the deployment and settingreplicas: 1
Reindexing events with default mapping
Follow these steps in order to reindex a workspace events datastream with the default index settings & mappings initialized (or updated) byprismeai-events:
- Find the correct name for the datastream you want to reindex and make sure it exists:
- List existing index templates and make sure an index template exists for your
events-*pattern:
Some workspaces like Knowledges have a custom specific index template tuned for their needs, with the workspace id included in their index & component template name.
composed_of) to all indices matching index_patterns.
The component template is where Prisme.ai custom index settings & mappings are configured.
- Create a temporary datastream:
index_patterns seen above so this new datastream will inherit default index settings & mappings.
- Reindex your data from the current to the temporary & remapped datastream:
"conflicts": "proceed" option to the body in order to ignore documents already created in destination index.
A response with {"failures": []} indicates all data have been reindexed & match the destination mapping.
In case of a mismatch between source data and destination mapping, you can receive error response like this:
- Delete the current datastream:
- Clone our temporary datastream to the “current” datastream exactly like we previously did the other way around:
hits.total.value: the number of matching documentsaggregations.latestDate.value_as_string: the latest matching document dateaggregations.oldestDate.value_as_string: the oldest matching document date
- Check from your browser that the target workspace events feed is not empty and contains old data, and that events previously failing to persist are now persisted. If everything is fine, you can delete the temporary datastream: