DPS Index Creation

DPS offers the ability to configure index creation per setting type in the HOCON configuration file (.conf).

Index creation is enabled by default.

This is also a toggleable feature, that can be explicitly enabled/disabled via ipf.dps.mongodb.create-indexes configuration property. In order to disable index creation, you just need to set it to false inside hocon configuration file.

By default, this property’s value is set to:

ipf.dps.mongodb.create-indexes = ${?ipf.mongodb.create-indexes}

So, if ipf.mongodb.create-indexes is set to false, index creation will not be executed. On the other hand, if ipf.mongodb.create-indexes is set to true, it will get executed. Also, as we mentioned above, since index creation is enabled by default, even if ipf.mongodb.create-indexes is not defined, index creation will still be executed.

Indexes are configured like in the following example:

ipf.dps.mongodb {
  // this value defaults to ipf.mongodb.create-indexes,
  // so if the referenced value is true, ipf.dps.mongodb.create-indexes is not required to be set explicitly
  create-indexes = true
  index-config {
    // index config for a setting type `SETTING_TYPE_1`
    SETTING_TYPE_1 {
      //example of a sinlge property index
      index-1 = ["property-1:ASC"],
      //example of a compound index
      index-2 = ["property-2:ASC","property-3.property-4.value:DESC"]
    }
    // index config for a setting type `SETTING_TYPE_2`
    SETTING_TYPE_2 {
      //example of a sinlge property index
      index-1 = ["property-1:ASC"],
      //example of a compound index
      index-2 = ["property-2:ASC","property-3.property-4.value:DESC"]
    }
    // default indexes for settings-approvals collection
    approvals {
      index-1 = ["processingEntity:ASC"]
      index-2 = ["entityId:ASC"]
      index-3 = ["entityCollection:ASC"]
      index-4 = ["lastUpdatedAt:ASC"]
    }
    // default indexes for settings-history collection
    history {
      index-1 = ["processingEntity:ASC"]
      index-2 = ["entityId:ASC"]
    }
  }
}

In this example, it is shown how indexes are configured for setting types SETTING_TYPE_1 and SETTING_TYPE_2. Each of these two types has index-1 which is a single property index, and index-2 which represents a compound index example.

If you set an index field (for example index-1) to empty array ([]), or you choose to remove the index from config, that index will be skipped.