Skip to main content
DocSearch supports searching multiple Algolia indices in a single query, allowing you to aggregate results from different data sources like documentation, blog posts, API references, and more.

Using the indices Prop

The indices prop accepts an array of index configurations. Each index can be specified as a string (index name only) or as an object with index-specific search parameters.

Basic Multiple Indices

Search across multiple indices with default settings:

Index-Specific Search Parameters

Each index can have its own search parameters to customize how results are retrieved and ranked:
The indices prop replaces the deprecated indexName and searchParameters props. While the old props still work for backward compatibility, new implementations should use indices.

TypeScript Interface

Common Search Parameters

When configuring index-specific parameters, you can use any Algolia search parameter:

Filtering Results

Controlling Result Display

Analytics

When insights is enabled at the top level, clickAnalytics is automatically enabled for all indices unless explicitly overridden.

Mixing with Other Features

Multiple Indices with Ask AI

You can use multiple indices for keyword search while configuring Ask AI separately:

Multiple Indices with transformItems

The transformItems function receives hits from all indices:

Migration from Deprecated Props

The indexName and top-level searchParameters props are deprecated and will be removed in a future version.

Before (Deprecated)

Best Practices

Performance

Keep the number of indices reasonable (typically 2-5) to maintain fast search performance.

Result Limits

Use hitsPerPage and maxResultsPerGroup to control how many results appear from each index.

Relevance

Use index-specific facetFilters and filters to ensure results are relevant to the current context (e.g., user’s selected version, language, or category).

Complete Example

Here’s a complete example searching across documentation, blog, and API reference indices: