getAlgoliaHits

Retrieves Algolia hits from multiple indices as arrays of records.

The getAlgoliaHits function lets you query several Algolia indices at once and returns the hits as an array of records.

Example#

This example uses the function along with the algoliasearch API client.

import { getAlgoliaHits } from '@algolia/autocomplete-js';
import algoliasearch from 'algoliasearch/lite';
const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
);
getAlgoliaHits({
searchClient,
queries: [
{
indexName: 'instant_search',
query,
params: {
hitsPerPage: 3,
},
},
],
}).then((hits) => {
console.log(hits);
});

Parameters#

See autocomplete-preset-algolia#getAlgoliaHits.