🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
Algolia CLI / Commands

Manage your Algolia indices.

algolia indices analyze

Usage
algolia indices analyze <index> [flags]

Display records statistics for the specified index.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Display records statistics for the "MOVIES" index for the first 1000 records
$ algolia index analyze MOVIES

# Display records statistics for the "MOVIES" index without limit
$ algolia index analyze MOVIES --no-limit

# Display records statistics for the "MOVIES" index for the first 1000 records and output the result as JSON
$ algolia index analyze MOVIES -o json

# Display records statistics for the "MOVIES" index with the "actors" attribute only
$ algolia index analyze MOVIES --only actors

Advanced

--attributeCriteriaComputedByMinProximity

When the Attribute criterion is ranked above Proximity in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage.

--distinct

Enables deduplication or grouping of results (Algolia’s distinct feature).

--enableABTest

Incidates whether this search will be considered in A/B testing.

--explain

Enriches the API’s response with information about how the query was processed.

--getRankingInfo

Incidates whether the search response includes detailed ranking information.

--maxFacetHits

Maximum number of facet hits to return when searching for facet values.

--minProximity

Precision of the proximity ranking criterion.

--percentileComputation

Whether to include or exclude a query from the processing-time percentile computation.

--renderingContent

Extra content for the search UI, for example, to control the ordering and display of facets. You can set a default value and dynamically override it with Rules.

--responseFields

Attributes to include in the API response for search and browse queries.

--synonyms

Whether to take into account an index’s synonyms for a particular search.

Analytics

--analytics

Indicates whether this query will be included in analytics.

--analyticsTags

Tags to apply to the query for segmenting analytics data.

--clickAnalytics

Indicates whether a query ID parameter is included in the search response. This is required for tracking click and conversion events.

Attributes

--attributesToRetrieve

Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.

Faceting

--attributesForFaceting

Attributes used for faceting and the modifiers that can be applied: filterOnly, searchable, and afterDistinct.
.

--facetingAfterDistinct

Forces faceting to be applied after de-duplication (with the distinct feature). Alternatively, the afterDistinct modifier of attributesForFaceting allows for more granular control.
.

--facets

Returns facets, their facet values, and the number of matching facet values.

--maxValuesPerFacet

Maximum number of facet values to return for each facet.

--sortFacetValuesBy

Controls how facet values are fetched.

Filtering

--enableReRanking

Indicates whether this search will use Dynamic Re-Ranking.

--facetFilters

Filter hits by facet value.
.

--filters

Filter the query with numeric, facet, or tag filters.
.

--numericFilters

Filter on numeric attributes.
.

--optionalFilters

Create filters to boost or demote records.

Records that match the filter are ranked higher for positive and lower for negative optional filters. In contrast to regular filters, records that don’t match the optional filter are still included in the results, only their ranking is affected.
.

--restrictSearchableAttributes

Restricts a query to only look at a subset of your searchable attributes.

--sumOrFiltersScores

Determines how to calculate filter scores.
If false, maximum score is kept.
If true, score is summed.
.

--tagFilters

Filter hits by tags.
.

--aroundLatLng

Search for entries around a central location, enabling a geographical search within a circular area.

--aroundLatLngViaIP

Search for entries around a location. The location is automatically computed from the requester’s IP address.

--aroundPrecision

Precision of a geographical search (in meters), to group results that are more or less the same distance from a central point.

--aroundRadius

Maximum radius for a geographical search (in meters).
.

--minimumAroundRadius

Minimum radius (in meters) used for a geographical search when aroundRadius isn’t set.

Highlighting and Snippeting

--attributesToHighlight

Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (highlightPreTag and highlightPostTag).

--attributesToSnippet

Attributes to snippet. ‘Snippeting’ is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: body:20.
.

--highlightPostTag

HTML string to insert after the highlighted parts in all highlight and snippet results.

--highlightPreTag

HTML string to insert before the highlighted parts in all highlight and snippet results.

--replaceSynonymsInHighlight

Whether to highlight and snippet the original word that matches the synonym or the synonym itself.

--restrictHighlightAndSnippetArrays

Restrict highlighting and snippeting to items that matched the query.

--snippetEllipsisText

String used as an ellipsis indicator when a snippet is truncated.

Languages

--decompoundQuery

Splits compound words into their component word parts in the query.
.

--ignorePlurals

Treats singular, plurals, and other forms of declensions as matching terms.
ignorePlurals is used in conjunction with the queryLanguages setting.
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages. true: enables the ignore plurals feature, where singulars and plurals are considered equivalent (“foot” = “feet”). The languages supported here are either every language (this is the default) or those set by queryLanguages. false: turns off the ignore plurals feature, so that singulars and plurals aren’t considered to be the same (“foot” will not find “feet”).
.

--keepDiacriticsOnCharacters

Characters that the engine shouldn’t automatically normalize.

--naturalLanguages

Changes the default values of parameters that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags, and ruleContexts. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.

--queryLanguages

Sets your user’s search language. This adjusts language-specific settings and features such as ignorePlurals, removeStopWords, and CJK word detection.

--removeStopWords

Removes stop (common) words from the query before executing it.
removeStopWords is used in conjunction with the queryLanguages setting.
list: language ISO codes for which stop words should be enabled. This list will override any values that you may have set in queryLanguages. true: enables the stop words feature, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language (this is the default) or those set by queryLanguages. false: turns off the stop words feature, allowing stop words to be taken into account in a search.
.

Other flags

--cursor

Cursor indicating the location to resume browsing from. Must match the value returned by the previous call.
Pass this value to the subsequent browse call to get the next page of results.
When the end of the index has been reached, cursor is absent from the response.
.

-n, --no-limit

If set, the command will not limit the number of objects to analyze. Otherwise, the default limit is 1000 objects.

--only

If set, the command will only analyze the specified attribute. Chosen attribute values statistics will be shown in the output.

--reRankingApplyFilter

When Dynamic Re-Ranking is enabled, only records that match these filters will be affected by Dynamic Re-Ranking.

--semanticSearch

Settings for the semantic search part of NeuralSearch. Only used when mode is neuralSearch.
.

Output formatting flags

--allow-missing-template-keys

If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.

-o, --output

Output format. One of: (json, jsonpath, jsonpath-as-json, jsonpath-file).

--template

Template string or path to template file to use when –output=jsonpath, –output=jsonpath-file.

Pagination

--hitsPerPage

Number of hits per page.

--length

Sets the number of hits to retrieve (for use with offset).

Note: Using page and hitsPerPage is the recommended method for paging results. However, you can use offset and length to implement an alternative approach to paging.
.

--offset

Specifies the offset of the first hit to return.

Note: Using page and hitsPerPage is the recommended method for paging results. However, you can use offset and length to implement an alternative approach to paging.
.

--page

Page to retrieve (the first page is 0, not 1).

Personalization

--enablePersonalization

Incidates whether Personalization is enabled.

--personalizationImpact

Defines how much Personalization affects results.

--userToken

Associates a user token with the current search.

Query strategy

--advancedSyntax

Enables the advanced query syntax.

--advancedSyntaxFeatures

Allows you to specify which advanced syntax features are active when advancedSyntax is enabled.

--alternativesAsExact

Alternatives that should be considered an exact match by the exact ranking criterion.

--disableExactOnAttributes

Attributes for which you want to turn off the exact ranking criterion.

--exactOnSingleWordQuery

Determines how the Exact ranking criterion is computed when the query contains only one word. One of: (attribute, none, word).

--mode

Search mode the index will use to query for results. One of: (neuralSearch, keywordSearch).

--optionalWords

Words which should be considered optional when found in a query.

--queryType

Determines how query words are interpreted as prefixes. One of: (prefixLast, prefixAll, prefixNone).

--removeWordsIfNoResults

Strategy to remove words from the query when it doesn’t match any hits. One of: (none, lastWords, firstWords, allOptional).

Ranking

--customRanking

Specifies the Custom ranking criterion. Use the asc and desc modifiers to specify the ranking order: ascending or descending.
.

--ranking

Determines the order in which Algolia returns your results.

--relevancyStrictness

Relevancy threshold below which less relevant results aren’t included in the results.

Rules

--enableRules

Incidates whether Rules are enabled.

--ruleContexts

Assigns rule contexts to search queries.

--query

Text to search for in an index.

--similarQuery

Overrides the query parameter and performs a more generic search.

Typos

--allowTyposOnNumericTokens

Whether to allow typos on numbers (“numeric tokens”) in the query string.

--disableTypoToleranceOnAttributes

Attributes for which you want to turn off typo tolerance.

--minWordSizefor1Typo

Minimum number of characters a word in the query string must contain to accept matches with one typo.

--minWordSizefor2Typos

Minimum number of characters a word in the query string must contain to accept matches with two typos.

--typoTolerance

Controls whether typo tolerance is enabled and how it is applied.

algolia indices clear

Usage
algolia indices clear <index> [flags]

Clear the specified index.

Examples

1
2
3
# Clear the index named "MOVIES"
$ algolia index clear MOVIES

Flags

-y, --confirm

skip confirmation prompt.

algolia indices config

Usage
algolia indices config [flags]

Manage your Algolia index config (settings, synonyms, rules).

algolia indices config export

Usage
algolia indices config export <index> [--scope <scope>...] [--directory] [flags]

Export an index configuration (settings, synonyms, rules) to a file.

Examples

1
2
3
4
5
6
7
8
9
# Export the config of the index 'MOVIES' to a .json in the current folder
$ algolia index config export MOVIES

# Export the synonyms and rules of the index 'MOVIES' to a .json in the current folder
$ algolia index config export MOVIES --scope synonyms,rules

# Export the config of the index 'MOVIES' to a .json into 'exports' folder
$ algolia index config export MOVIES --directory exports

Flags

-d, --directory

Directory path of the output file (default: current folder).

-s, --scope

Scope to export (default: all).

algolia indices config import

Usage
algolia indices config import <index> -F <file> --scope <scope>... [flags]

Import an index configuration (settings, synonyms, rules) from a file.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Import the config from a .json file into 'PROD_MOVIES' index
$ algolia index config import PROD_MOVIES -F export-STAGING_MOVIES-APP_ID-1666792448.json

# Import only the synonyms and settings from a .json file to the 'PROD_MOVIES' index
$ algolia index config import PROD_MOVIES -F export-STAGING_MOVIES-APP_ID-1666792448.json --scope synonyms, settings

# Import only the synonyms from a .json file to the 'PROD_MOVIES' index and clear all existing ones
$ algolia index config import PROD_MOVIES -F export-STAGING_MOVIES-APP_ID-1666792448.json --scope synonyms --clear-existing-synonyms

# Import only the rules from a .json file to the 'PROD_MOVIES' index and clear all existing ones
$ algolia index config import PROD_MOVIES -F export-STAGING_MOVIES-APP_ID-1666792448.json --scope rules --clear-existing-rules

Flags

-r, --clear-existing-rules

Clear ALL existing rules of the index before import.

-o, --clear-existing-synonyms

Clear ALL existing synonyms of the index before import.

-y, --confirm

Skip confirmation prompt.

-F, --file

Directory path of the JSON config file.

-l, --forward-rules-to-replicas

Forward imported rules to replicas.

-t, --forward-settings-to-replicas

Forward imported settings to replicas.

-m, --forward-synonyms-to-replicas

Forward imported synonyms to replicas.

-s, --scope

Scope to import (default: none).

algolia indices copy

Usage
algolia indices copy <source-index> <destination-index> [flags]

Make a copy of an index.

Examples

1
2
3
4
5
6
7
8
9
# Copy the records, settings, synonyms and rules from the "SERIES" index to the "MOVIES" index
$ algolia indices copy SERIES MOVIES

# Copy only the synonyms of the "SERIES" to the "MOVIES" index
$ algolia indices copy SERIES MOVIES --scope synonyms

# Copy the synonyms and rules of the index "SERIES" to the "MOVIES" index
$ algolia indices copy SERIES MOVIES --scope synonyms,rules

Flags

-y, --confirm

skip confirmation prompt.

-s, --scope

scope to copy (default: all).

-w, --wait

wait for the operation to complete.

algolia indices delete

Usage
algolia indices delete <index> [flags]

Delete one or multiple indices.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Delete the index named "MOVIES"
$ algolia indices delete MOVIES

   # Delete the index named "MOVIES" and its replicas
   $ algolia indices delete MOVIES --includeReplicas

# Delete the index named "MOVIES", skipping the confirmation prompt
$ algolia indices delete MOVIES -y

# Delete multiple indices
$ algolia indices delete MOVIES SERIES ANIMES

Flags

-y, --confirm

skip confirmation prompt.

-r, --includeReplicas

delete replica indices too.

algolia indices list

Usage
algolia indices list [flags]

List indices.

Examples

1
2
3
# List indices
$ algolia indices list

Output formatting flags

--allow-missing-template-keys

If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.

-o, --output

Output format. One of: (json, jsonpath, jsonpath-as-json, jsonpath-file).

--template

Template string or path to template file to use when –output=jsonpath, –output=jsonpath-file.

algolia indices move

Usage
algolia indices move <source-index> <destination-index> [flags]

Move an index.

Examples

1
2
3
# Move the "TEST_MOVIES" index to "DEV_MOVIES"
$ algolia indices move TEST_MOVIES DEV_MOVIES

Flags

-y, --confirm

skip confirmation prompt.

-w, --wait

wait for the operation to complete.

Did you find this page helpful?