Retrieves Algolia hits from multiple indices as arrays of records.
getAlgoliaHits function lets you query several Algolia indices at once and returns the hits as an array of records.
If you're using
autocomplete-js, all Algolia utilities are available directly in the package with the right user agents and the virtual DOM layer. You don't need to import the preset separately.
First, you need to install the preset.
Then import it in your project:
If you don't use a package manager, you can use a standalone endpoint:
This example uses the function along with the
algoliasearch API client.
The initialized Algolia search client.
The queries to perform, with the following parameters:
The index name to search into.
The query to search for.
Algolia search parameters.
These are the default search parameters. You can leave them as is and specify other parameters, or override them.
The function returns a promise that resolves to a response with the following schema: