Search code examples
marklogic

Comparison of different ways to update Marklogic Content DB Index via ML Gradle


I have more than 50 different types of indexes set up in a marklogic content database. The database contains half a million XML documents. It will take more than 6 hours to rebuild all the indexes.

If I just want to update one index setting, what is the best way to refresh just that index?

Here is what I observed. I would like to confirm whether my observation and understanding below are correct.

  1. mlUpdateIndexes will simply update the index setting. It won't trigger a rebuild of the index.
  2. mlDeploy will update the db index and trigger just that updated index rebuild. Normally, it is the fastest option. (That is what I am using.) It will take about 30 mins to rebuild the index. (That is why I think it just rebuilds the index that has been changed and without rebuilding the indexes that have not been updated.)
  3. mlReindexContentDatabase will trigger a full index rebuild. I guess it will rebuild everything, including all 50 different indexes, regardless of whether it has been recently changed or not.
  4. mlReindexDatabase same as 3)??

Is my above understanding correct? Which ml-gradle task should I use to do a quick search test for different index configuration settings?


Solution

  • If you want it more targeted, and faster to just deploy the indexes, then I would use mlUpdateIndexes.

    If you have re-indexing enabled on the database, then when you apply your new index with mlUpdateIndexes, it should start reindexing the content matching that new index.

    I wouldn't expect different indexing behavior from mlDeploy. With mlDeploy it will deploy the index changes as well as any other project configurations. So, the deploy command could take longer and might push other config changes that you may not want to adjust if you were intending only to make one index change.

    mlReindexContentDatabase will initiate a full reindex, regardless of what needs indexing of the database named by mlAppConfig.contentDatabaseName.

    mlReindexDatabase basically does the same thing, but it reindexes the database named by the project property dbName e.g. gradlew mlReindexDatabase -PdbName=my-database