Indexing APIs and Seeding
  • 22 May 2023
  • Dark
    Light
  • PDF

Indexing APIs and Seeding

  • Dark
    Light
  • PDF

Article summary

Indexing within IAP is no longer done via indexing scripts, but rather via indexing APIs that can be called while IAP is running. If an application is not installed, any indexes related to its collections are not required.

It is also important to note that collections that do not already exist will automatically be created and properly indexed when IAP starts. For all new installations, manual indexing is not required. However, when additional indexes are required or an index is accidentally dropped, it is recommended that indexing APIs are used to validate the existing indexes and create the missing or misnamed indexes.

Initial Index Validation

To verify that a collection is properly indexed, Itential recommends using the GET /indexes/:collectionName/status API which will return an object containing all missing or misnamed indexes. When used on the jobs collection, for example, this would look like GET /indexes/jobs/status. Any collections which are incorrectly indexed should go through the index creation API.

Index Creation

Itential recommends that you create indexes only during a maintenance window, especially for large collections like jobs and tasks. Indexing these collections may take some time and have an impact on MongoDB performance until they are fully created.

If a collection is not properly indexed, the POST /indexes/:collectionName API will create any missing indexes and also drop then recreate any indexes with an incorrect name. For the jobs collection this will look something like POST /indexes/jobs with an empty request body. All collections that are properly indexed or not included in the predefined indexes will be ignored. Likewise, if the index creation process has already been started once, this will not cause a second index creation to be inititated in MongoDB. Finally, this API initiates the index creation, but will not wait for it to complete before responding since index creation can take a significant amount of time.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.