Deleting the OpenSearch data

Next, you delete the existing data in OpenSearch.

Before you begin

Back up your OpenSearch data before you delete it.

About this task

IBM® Business Automation Insights uses the following OpenSearch indices to store case events: icp4ba-bai-case-timeseries-idx-ibm-bai-*, icp4ba-bai-case-summaries-active-idx-ibm-*, and icp4ba-bai-case-summaries-completed-idx-ibm-bai-*.

Process events for Case are stored in the following indices, with category 'icm'. Note that those indices also have BPMN events.
icp4ba-bai-process-summaries-active-idx-ibm-bai-*
icp4ba-bai-process-summaries-completed-idx-ibm-bai-*

Procedure

  1. Run the following commands:
    a.
    export OPENSEARCH_URL=$(oc get route opensearch-route -o jsonpath='{.status.ingress[0].host}')
    b.
    export OPENSEARCH_USERNAME="elastic"
    c.
    export OPENSEARCH_PASSWORD=$(oc extract secret/opensearch-ibm-elasticsearch-cred-secret --to=- --keys=elastic 2>/dev/null)
  2. Run the following cURL commands to delete the documents in the index:
    • Replace the asterisk (*) with the actual index name.
    • Or, if you are sure that all indices are used only for the Case Flink job, you can keep the asterisk.
    curl -X POST -u $OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD "https://$OPENSEARCH_URL/case-summaries-completed-*/_delete_by_query?pretty" -H 'Content-Type: application/json' --insecure -d'
    {
      "query": {
        "match_all": {}
      }
    }
    '
    
    curl -X POST -u $OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD "https://$OPENSEARCH_URL/case-summaries-active-*/_delete_by_query?pretty" -H 'Content-Type: application/json' --insecure -d'
    {
      "query": {
        "match_all": {}
      }
    }
    '
    
    curl -X POST -u $OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD "https://$OPENSEARCH_URL/case-timeseries-*/_delete_by_query?pretty" -H 'Content-Type: application/json' --insecure -d'
    {
      "query": {
        "match_all": {}
      }
    }
    '
    
    curl -X POST -u $OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD "https://$OPENSEARCH_URL/process-summaries-completed-*/_delete_by_query?pretty" -H 'Content-Type: application/json' --insecure -d'
    {
      "query": {
        "term": {
            "category": "icm"
        }
      }
    }
    '
    
    curl -X POST -u $OPENSEARCH_USERNAME:$OPENSEARCH_PASSWORD "https://$OPENSEARCH_URL/process-summaries-active-*/_delete_by_query?pretty" -H 'Content-Type: application/json' --insecure -d'
    {
      "query": {
        "term": {
            "category": "icm"
        }
      }
    }
    '