Documentation Center

Refreshing the OpenSearch index by running a script

The process of updating the OpenSearch index requires the Content Deployer to temporarily halt indexing while the index is updated. This is accomplished by "locking" the Content Deployer for the duration of the reindexing process. If this process takes a long time, you may want to consider creating a cron job to schedule a scripted reindex at regular intervals during quiet periods. This task explains which script to run and how to configure it.

About this task

Once locked, the Content Deployer periodically checks for the release of the lock. a particular lock being released. There is a configuration property that defines a time interval between these checks (time units are seconds). Only after release of this lock, the Content Deployer becomes available for indexing operations.

Procedure

  1. On your installation media, go to Content Delivery\roles\iq\opensearch\.
  2. Do one of the following:
    • If you are on a Windows machine, copy manageOpenSearchIndex.ps1.
    • If you are on a Unix machine, copy manageOpenSearchIndex.sh.
  3. By default, the Content Deployer checks every 5 seconds if the lock is released, so it can resume indexing. If you want to, you can configure a different checking interval. To do so, do the following:
    1. Go to the configuration location of your Content Deployer.
    2. Open application.properties for editing.
    3. Find the taxonomy.bluegreen.execution.checkintervalseconds property, and set it to the desired numbers of seconds.
    4. Save and close application.properties.
    5. Restart the Content Deployer service.
  4. To perform a scripted reindex, do one of the following:
    • On a Windows machine, execute the Powershell command manageOpenSearchIndex.ps1 -Reindex true.
    • On a Unix machine, execute the shell command manageOpenSearchIndex.sh --blue-green-reindex true.
    You can execute these from the command line, or include them in a cron job. You can also add any number of OpenSearch parameters that you normally pass to a microservice installation script, like index-common-name-prefix, os.host and so on.