Bleve has a powerful feature called an IndexAlias
. The IndexAlias can be used to search an index, with the additional ability to atomically switch the underlying physical index. IndexAliases can also be used to search across multiple indexes at the same time and correctly merge the results.
First, its useful to note that thanks to Go interfaces, an IndexAlias is also an Index. This means that in general you work with an IndexAlias just as you would work with an Index. The alias concept also adds 3 methods: Add(), Remove(), and Swap()
Add, will add one or more indexes to the alias. Remove will remove one or more indexes from the alias. Swap will atomically add/remove the provided indexes. (all other ops, like search will see the alias before or after all adds/removes are done)
Your application will safely switch to searching the new index.
Your application will search across all the underlying indexes at the same time, and the results will be merged together into a single result.
When and IndexAlias points to multiple indexes not all operations are supported. Only operations which can be invoked on all the child indexes and have their responses aggregated are supported. Operations that are not supported return bleve.ErrorAliasMulti
.