HCL Commerce Version 9.1.13.0 or later

Backing up and restoring an index

The Ingest service automatically retains backups of the most recent indexes. You can change the number of backups that are retained, and you can easily switch to a backup index for your Search services to use.

Prerequisites

Ensure you have enough storage space to hold all the indexes you intend to keep. Insufficient storage capacity in Elasticsearch can result in a site outage.

HCL Commerce Version 9.1.13.0 or later

Index backups

When you build an index, by default backup copies are kept of the previous two builds. This setting does not affect performance, although, in certain circumstances you may notice apparent inconsistencies in your logs. For example, if you run several Store 1, Store 11 or eSite index rebuilds in a quick succession, you would expect to see only one index present with the latest timestamp. Because backups are kept, however, in such a case you may observe two indexes present that have the same timestamp. This merely indicates that backups are being created and that the most recent backup has been given the same timestamp as the current live index.

You can control index backup behavior using the alias.keep.backup configuration setting. First, you can verify the current setting by issuing a GET request to the following REST endpoint:
https://Data-Query:Port/search/resources/api/v2/configuration?nodeName=ingest&envType=auth
Search for the alias.keep.backup parameter. Its default setting is 2.
To change the setting, issue a PATCH request to the same endpoint. For example, to set the number of backups to zero (the default behavior prior to Version 9.1.13), issue the PATCH with the following body:
Body: 
{
    "global": {
        "connector": [
            {
                "name": "attribute",
                "property": [
                    
{                                                  "name": "alias.keep.backup",                         "value": "0"                                        }

                ]
            }
        ]
    }
}
For this example, the result is that no backup indexes are created. You can adjust the number of backups as appropriate to your environment.
HCL Commerce Version 9.1.13.0 or later

Switching to a backup index

When Ingest performs a full re-indexing operation, each build is tagged with a unique revision identifier. This identifier is a twelve digit number in the format of YYYYMMDDHHMM, called time.id. For example, the product index name can be .auth.11.product.202405142058. To reveal all revisions from the available indexes in Elasticsearch, use the following Elasticsearch API:
/_cat/indices?v&s=index

For more information about this endpoint, refer to cat indices API in the Elasticsearch documentation.

When you have identified the time.id that you want to swtich to, use the following Ingest API to perform the index alias switching:
POST /connectors/envType.alias/run?storeId=storeId&timeId=timeId
where
envType
Either "auth" or "live".
storeId
The owning store identifier.
timeId
The twelve-digit time identifier.