The Search API client is part of the algoliasearch package. To install this package, run:

1
npm install algoliasearch

To use the Search client:

1
2
3
4
import { algoliasearch } from "algoliasearch";

const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const searchClient = client.initSearch();

The algoliasearch package includes API clients for the Search, Recommend, Analytics, A/B testing, and Personalization API. If you just want to use the Search API client, you can install its package on its own:

1
npm install @algolia/client-search

To use it, run:

1
2
3
4
5
6
import { searchClient } from "@algolia/client-search";

const client = searchClient(
  "ALGOLIA_APPLICATION_ID",
  "ALGOLIA_API_KEY"
);

If you just want to use the Search method of the Search API to search multiple indices for matching records or facet values, you can use the liteClient:

1
2
3
import { liteClient } from "algoliasearch/lite";

const client = liteClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

List of methods

Each method makes one request to the Search API. The Search API client also includes helper methods that wrap one or more of these methods. For more information, see Helper methods.

Records

Indices

Synonyms

API keys

Rules

Dictionaries

Clusters

Vaults

Advanced

Did you find this page helpful?
JavaScript API clients v5