If all the records and settings in your index disappear, you may have a bug in your indexing implementation. Here are the most common causes:
- Overriding setSettings operations.
- An issue with the reindexing functionality.
Overriding setSettings operations
To investigate this you can check your logs for setSettings operations or copySettings operations and look for overwrites.
An issue with the reindexing functionality
A proper reindexing system should work as follows:
- Copy settings, synonyms, and rules from your original index to a temporary index.
- Add your new records to the temporary index.
- Replace your original index with the temporary index.
Having an issue on the reindexing logic may alter this cycle and cause a replacement of the original index with e.g. an empty temporary index.
Another possible issue would be to run duplicated reindexing operations, which could cause issues like the following:
- Job A copies settings from the source index to the temporary index which creates a new temporary index (i.e. MyTempIndex)
- Job B copies settings from the source index to the temporary index with the same name (i.e. MyTempIndex)
- Job A adds records to the temporary index
- Job B adds records to the temporary index
- Job A renames the 'MyTempIndex' index to 'MyPermanentIndex', which overwrites the existing 'MyPermanentIndex' index with the temporary index MyTempIndex maintaining the original settings and records. 'MyTempIndex' index disappears once after this operation.
- Job B keeps adding records to the temporary index('MyTempIndex') expecting it still existed. This operation, however, creates a new temporary index ('MyTempIndex') without maintaining settings copied from the original index.
- Job B renames the 'MyTempIndex' index to 'MyPermanentIndex', which overwrites the existing 'MyPermanentIndex' index with the new temporary index without settings and records