Breadcrumbs

Database Index Creation Guide

This document describes the steps for adding the index on conversation manager DB to improve the reporting connector performance

Steps

  1. SSH on the target server

  2. To connect to your database, create a MongoDB® client container. Run following command

    kubectl run --namespace ef-external mongo-mongodb-client --rm --tty -i --restart='Never' --env="MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD" --image docker.io/bitnami/mongodb:6.0.2-debian-11-r1 --command -- bash
    k exec  -it mongo-mongodb-client -n ef-external -- bash
    mongosh admin --host "mongo-mongodb"
    use conversation-manager_db
    
  3. Run use conversation-manager_db command and add the following indexes on conversations collection.

    db.conversation.createIndex( { "endTime": 1 })
    db.CustomerTopicEvents.createIndex( { "customer._id": 1 })
    
  4. A add the following indexes on CustomerTopicEvents collection.

    db.CustomerTopicEvents.createIndex( { "cimEvent.name": 1 })
    db.CustomerTopicEvents.createIndex( { "cimEvent.type": 1 })
    db.CustomerTopicEvents.createIndex( { "customerId": 1 })
    db.CustomerTopicEvents.createIndex( { "topicId": 1 })
    db.CustomerTopicEvents.createIndex( "recordCreationTime":1})
    db.CustomerTopicEvents.createIndex({ "cimEvent.data.channelSession.channel.channelConfig.routingPolicy.routingMode": 1 })
    db.CustomerTopicEvents.createIndex("cimEvent.data.body.type: 1 })
    db.CustomerTopicEvents.createIndex({"cimEvent.data.body.wrapups": 1 })
    
    
  5. Run use state-events-logger_cx_db command and add indexes on agentStateChanheEvents collection.

    db.agentStateChangeEvents.createIndex( { "name": 1 })
    db.agentStateChangeEvents.createIndex({ "data.agentStateChanged": 1 })
    db.agentStateChangeEvents.createIndex({ "data.agentPresence.stateChangeTime": 1 })
    db.agentStateChangeEvents.createIndex({ "data.agentPresence.agentMrdStates": 1 })
    db.agentStateChangeEvents.createIndex({ "stateChangeTime": 1 })
    db.agentStateChangeEvents.createIndex({"data.agentPresence.state.name": 1 })