You can easily modify an index using the dsconfig tool. Any modification or addition of an index requires the indexes to be rebuilt. In general, an index only needs to be built once after it has been added to the configuration.

If you add an index, then import the data using the import-ldif tool, then the index will be automatically rebuilt. If you add an index, then add the data using some other method than import-ldif, you must rebuild the index using the rebuild-index tool.

  1. Use dsconfig with the set-local-db-index-prop option and the --index-name and --backend-name properties. In this example, update the prime-index property, which loads the index at startup. This command requires the --advanced option to access this property.
    $ bin/dsconfig set-local-db-index-prop --index-name uid \ 
      --backend-name userRoot --set prime-index:true
  2. View the index to verify the change.
    $ bin/dsconfig get-local-db-index-prop --index-name uid \ 
      --backend-name userRoot
  3. Stop the Directory Server. You can do an index rebuild with the server online; however, keep in mind the tips presented in General Tips on Indexes.
    $ bin/stop-server
  4. Run the rebuild-index tool.
    $ bin/rebuild-index --baseDN dc=example,dc=com --index uid
  5. Restart the Directory Server if shutdown.
    $ bin/start-server