Reindexing
This section will explain how to trigger a reindex in flex. Reindex can be a global reindex but can also be more granualar (reindex a collection, reindex an asset)
flex installation scripts
flex inventory
access to all flex hosts through ssh using an ssh key (you can use passwords too, please read ansible documentation for this)
You need to get the IP address(es) of the flex indexelastic service. Please refer to inventory operation guide to find them
Trigger a full reindex
-
Whenever starting a full reindex you need to ensure the elasticserch hosts to have enough free disk space to double the indices size on the disk at a minimum (
du /flex/elasticsearch) -
Never start two full reindex at the same time. Prior to start one always ensure there is not another running. This would have desastrous performance impact and require huge disk space
check a full reindex is processing
To determine whether a full reindex is in progress you can query the following endpoint:
curl -X GET "http://<indexelastic-host>:18116/api/reindex/redis/inprogress-flag"
- An alternative approach is to query ElasticSearch for a list of indices. If there are more than one per object type (e.g. both
flex-assets-2025-07-30-0858andflex-assets-2025-07-25-1403exist) then the reindex is still in progress.
curl http://<elasticsearch-host>:9200/_cat/indices
trigger a full reindex:
flexctl -e $env reindex full
or
curl -X POST "http://<indexelastic-host>:18116/api/reindex"
Note that you cannot kick off a new full reindex until the previous one has completed (the API will error if you try).
Check if a full reindex is in progress
If you are in doubt that one full reindex is ongoing or you want to check if the one you launched is still running:
flexctl -e $env full reindex --check
Check the full reindex completion
Once the full reindex is completed you can confirm completion by looking at the current indices timestamp
flexctl -e $env get indices
curl http://<elasticsearch-host>:9200/_cat/indices
Cancel an ongoing full reindex
In the eventuality you need to cancel an ongoin full reindex command, please use the below command
curl -X DELETE "http://<indexelastic>:18116/api/reindex"
The timestam of the flex-xxxx indices must match the starting hour (server time) you starting the reindex
Partial reindexes
Partial reindexes may be performed in one of two scenarios:
- Automatically, by the system, e.g. when a metadata definition has been updated, following a successful Metadata Merge operation
- Manually, by an administrator, e.g. to restore service by reindexing one type at a time, if unexpected issues were encountered while performing a Full Reindex.
- To reindex Collections:
curl -X POST -H "Content-Type: application/json" "http://<indexelastic-host>:18116/api/reindex/collections"
- To reindex a single Collection
curl -X POST "http://<indexelastic-host>:18116/api/index/collections/<collectionUuid>"
- To reindex Variants:
curl -X POST "http://<indexelastic-host>:18116/api/reindex/variants"
- To reindex any other type of Flex object, e.g.:
curl -X POST -H "Content-Type: application/json" -d '{ "objectType": "media-asset" }' "http://<indexelastic-host>:18116/api/reindex/objects"
- To synchronously index a single asset, UDO or whatever; e.g. for asset ID 234:
curl -X POST -H "Content-Type: application/json" "http://<indexelastic-host>:18116/api/index/objects/234"
- To reindex multiple assets or UDOs via a Unix file:
time cat file_with_id | while read ; do curl -X POST -H "Content-Type: application/json" http://<indexelastic-host>:18116/api/index/objects/$REPLY ; done
Don't overload the system with multiple concurrent partial reindexes!
There is no protection in the system to prevent multiple concurrent partial reindexes.
If you trigger partial reindexes where there may be significant numbers of objects (e.g. Media Assets, UDOs, etc), then the recommendation is to monitor the flex-indexelastic-service Grafana dashboard and observe the graph of the flex.indexelastic.indexdeduped queue, and avoid triggering further reindexes until:
- at very least, the queue length has stopped increasing;
- ideally, the queue length has returned to zero.