multisearch breaks when one of the indexes is not found.
sjorsjes opened this issue · comments
Description
I have Meilisearch running in a kubernetes environment with no volume attached. When i reboot the Meilisearch container the indexes are cleared. For my situation that's fine and not an issue because most indexes are refreshed every 15min/1h.
But I implemented multiSearch and when Meilisearch had a reboot it can happen that not all indexes are back.
Expected behavior
I would expect that the Multisearch query would not break and just continue giving me results for the indexes that can be found.
Current behavior
Multisearch breaks and throws an error Inside '.queries[0]': Index 'documents' not found.
and returns no results.
class_1 [MeiliSearchApiError]: Inside `.queries[0]`: Index `documents` not found.
at <path>/node_modules/meilisearch/dist/bundles/meilisearch.cjs.js:187:23
at step (<path>/node_modules/meilisearch/dist/bundles/meilisearch.cjs.js:104:23)
at Object.next (<path>/node_modules/meilisearch/dist/bundles/meilisearch.cjs.js:85:53)
at fulfilled (<path>/node_modules/meilisearch/dist/bundles/meilisearch.cjs.js:75:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'index_not_found',
type: 'invalid_request',
link: 'https://docs.meilisearch.com/errors#index_not_found',
httpStatus: 400
}
Environment (please complete the following information):
- OS: Node 18.x
- Meilisearch version: 1.1.1
- meilisearch-js version: 0.32.3
- Browser: Any
Ah okay, thanks for the headsup!
For people with the same issue, I workaround this issue by checking with the client.getStats()
what indexes are available and then do a multisearch for all indexes that exists.
https://www.meilisearch.com/docs/reference/api/stats#get-stats-of-all-indexes