Skip to content
Software capabilities
Algolia

Search a single Algolia index

Search one index with a query through Algolia’s Search API or JavaScript client. Use a search-only API key in client-side applications.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. API: POST /1/indexes/{indexName}/query
  2. SDK: client.searchSingleIndex()
API

POST /1/indexes/{indexName}/query

Submit a search query and return matching hits from one index.

Read source: Algolia Search API single-index search
Requirements
The application ID, index name, and API key with the search ACL and any required access restrictions.
Limitations
A search request returns at most 1,000 hits. Use browse for larger result sets or raise the index paginatedLimitedTo setting.

Example shell

curl --fail -X POST "https://$ALGOLIA_APPLICATION_ID.algolia.net/1/indexes/$INDEX_NAME/query" \
  -H "x-algolia-application-id: $ALGOLIA_APPLICATION_ID" -H "x-algolia-api-key: $ALGOLIA_SEARCH_API_KEY" \
  -H "content-type: application/json" -d '{"query":"keyboard"}'
SDK

client.searchSingleIndex()

Search the selected index from a JavaScript application using the Algolia client.

Read source: Algolia JavaScript single-index search
Requirements
An initialized Algolia JavaScript client, index name, and API key with search permission.
Limitations
The method returns up to 1,000 hits. Use browse or change paginatedLimitedTo when a larger result window is required.

Example text

const response = await client.searchSingleIndex({ indexName: "products" });