Skip to main content
The examples on this page use your current application. Examples that transform JSON use jq. For more information, see Work with JSON data.

Export your Algolia data

To create a backup of your index (records, rules, settings, and synonyms), run these commands:
To upload the records, synonyms, or rules in the Algolia dashboard, convert them to JSON first. To export all your settings, synonyms, and rules in a single file, use the algolia indices config export command. This command creates a JSON file that you can import in the dashboard.

Import your Algolia data

To import records from a file, run one of these commands:
To import synonyms or rules, use the same commands with synonyms or rules instead of objects. To import settings from a JSON object, run:
To import a JSON file with all your settings, synonyms, and rules, use the algolia indices config import command. You can export the JSON file from the dashboard, or with the algolia indices config export command.

Compare index settings

To compare the settings of two indices, use the Algolia CLI with the diff and jq commands. This example uses process substitution:
If the output of algolia settings get goes to a pipe, the command prints compact JSON. The jq command formats the JSON so that you can see the differences.
Replace INDEX_1 and INDEX_2 with the names of the indices you want to compare. If the indices aren’t in your current application, set the ALGOLIA_APPLICATION_ID and ALGOLIA_API_KEY environment variables.

Copy indices between applications

To copy an index (records, synonyms, rules, and settings) between two Algolia applications, export each part with a browse or get command. Then pipe the output into the matching import command. Environment variables take precedence over the --application-id and --api-key options. To make sure each command uses the right application, set the credentials as environment variables for each command. This syntax works in Bash and Zsh:
Replace APP_ID_1/API_KEY_1 and APP_ID_2/API_KEY_2 with the credentials of the source and destination applications.

Copy specific index settings

To copy only some index settings, filter the output of algolia settings get with jq. For example, to copy all index settings except queryLanguages and indexLanguages, run:

Change settings while copying

To change index settings while you copy them, edit the output of algolia settings get with jq. For example, to change the queryLanguages and indexLanguages settings to French, run:

Reindex without downtime

To replace all records in an index without interrupting search, build the new version in a temporary index, then move it over the live index.
Moving an index replaces the destination and deletes the source. Search requests to INDEX keep returning the old records until the move completes. In a script or another non-interactive shell, add --confirm to the copy and move commands.

Search an index

To test a query from the terminal, pass it to algolia search:
To restrict the results, add --filters, --hitsPerPage, and --page:
Facet filters, such as genres:Animation, work only on attributes in attributesForFaceting. To keep the response small, select the response properties and record attributes to return:
To save only the hits to a file, use the jsonpath output format:

Check attribute types and frequency

To see how consistent your records are, run algolia indices analyze. This command shows how often each attribute occurs and which types it has. Use this report to find attributes that some records don’t have, or attributes with the wrong type, such as a null in a numeric attribute:
By default, the command analyzes the first 1,000 records. To analyze every record, add --no-limit. For large indices, this can take a long time. To see how often each value of one attribute occurs, add --only:
To find the affected records, see Find records with missing attributes.

Find records with missing attributes

To find records that don’t have an attribute, filter the output of algolia objects browse with jq. For example, to find records without a name attribute, run:
The --attributesToRetrieve flag includes only the name attribute in the API response. The jq command selects all records without a name attribute. Then it returns a list of their object IDs. To get a comma-separated list, add | join(",") to the end of the jq filter.

Delete records with a missing attribute

To delete all records that don’t have an attribute, combine the previous command with algolia objects delete.
Before you delete records, run the delete command with --dry-run to preview the records that it removes. You can’t restore deleted records.
In a script or another non-interactive shell, add --confirm to the delete command.

Create a search-only API key

To create a key for a frontend that can search only one index, set the search ACL and limit the key to that index:
The command prints the new key. To create a key that expires, pass an Admin API key with --api-key and add --validity. For more information, see algolia apikeys create.

Work with JSON data

You can use the Algolia CLI with other command-line tools, such as jq to process JSON data. You can install jq with your package manager, or download a binary from the Releases page of the GitHub repository.

Newline-delimited JSON

Newline-delimited JSON (NDJSON), also called JSON Lines (JSONL), is a file format for streams of JSON objects. Each line is a valid JSON object, so you can process each object while you read the stream. With a JSON array, you must read the full array before you can parse it.

Convert between JSON and NDJSON

You can convert between JSON and NDJSON with jq:
Last modified on November 20, 2026