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

Manage your indices’ objects.

algolia objects browse

Usage
algolia objects browse <index> [flags]

Browse the index objects.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Browse the objects from the "MOVIES" index
$ algolia objects browse MOVIES

# Browse the objects from the "MOVIES" index and select which attributes to retrieve
$ algolia objects browse MOVIES --attributesToRetrieve title,overview

# Browse the objects from the "MOVIES" index with filters
$ algolia objects browse MOVIES --filters "genres:Drama"

# Browse the objects from the "MOVIES" and export the results to a new line delimited JSON (ndjson) file
$ algolia objects browse MOVIES > movies.ndjson

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

--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 objects delete

Usage
algolia objects delete <index> [--object-ids <object-ids> | --filters  <filters>...] [--confirm] [--wait] [flags]

Delete objects from an index.

Examples

1
2
3
4
5
6
7
8
9
# Delete one single object with the ID "1" from the "MOVIES" index
$ algolia objects delete MOVIES --object-ids 1

# Delete multiple objects with the IDs "1" and "2" from the "MOVIES" index
$ algolia objects delete MOVIES --object-ids 1,2

# Delete all objects matching the filters "type:Scripted" from the "MOVIES" index
$ algolia objects delete MOVIES --filters "type:Scripted" --confirm

Filtering

--facetFilters

Filter hits by facet value.
.

--filters

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

--numericFilters

Filter on numeric attributes.
.

--tagFilters

Filter hits by tags.
.

--aroundLatLng

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

--aroundRadius

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

Other flags

-y, --confirm

skip confirmation prompt.

--object-ids

Object IDs to delete.

--wait

wait for all the operations to complete before returning.

algolia objects import

Usage
algolia objects import <index> -F <file> [flags]

Import objects to the specified index.

Examples

1
2
3
4
5
6
7
8
9
# Import objects from the "data.ndjson" file to the "MOVIES" index
$ algolia objects import MOVIES -F data.ndjson

# Import objects from the standard input to the "MOVIES" index
$ cat data.ndjson | algolia objects import MOVIES -F -

# Browse the objects in the "SERIES" index and import them to the "MOVIES" index
$ algolia objects browse SERIES | algolia objects import MOVIES -F -

Flags

--auto-generate-object-id-if-not-exist

Automatically generate object ID if not exist.

-b, --batch-size

Specify the upload batch size.

-F, --file

Read records to import from file (use “-“ to read from standard input).

algolia objects operations

Usage
algolia objects operations -F <file> [--wait] [--continue-on-errors] [flags]

Perform several indexing operations.

Examples

1
2
3
# Batch operations from the "operations.ndjson" file
$ algolia objects operations -F operations.ndjson

Flags

-C, --continue-on-error

Continue processing operations even if some operations are invalid.

-F, --file

The file to read the indexing operations from (use “-“ to read from standard input).

-w, --wait

Wait for the indexing operation(s) to complete before returning.

algolia objects update

Usage
algolia objects update <index> -F <file> [--create-if-not-exists] [--wait] [--continue-on-error] [flags]

Update objects from a file to the specified index.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Update objects from the "objects.ndjson" file to the "MOVIES" index
$ algolia objects update MOVIES -F objects.ndjson

# Update objects from the "objects.ndjson" file to the "MOVIES" index and create the objects if they don't exist
$ algolia objects update MOVIES -F objects.ndjson --create-if-not-exists

# Update objects from the "objects.ndjson" file to the "MOVIES" index and wait for the operation to complete
$ algolia objects update MOVIES -F objects.ndjson --wait

# Update objects from the "objects.ndjson" file to the "MOVIES" index and continue updating objects even if some objects are invalid
$ algolia objects update MOVIES -F objects.ndjson --continue-on-error

Flags

-C, --continue-on-error

Continue updating objects even if some objects are invalid.

-c, --create-if-not-exists

If provided, updating a nonexistent object will create a new object with the objectID and the attributes defined in the object.

-F, --file

Read objects to update from file (use “-“ to read from standard input).

-w, --wait

Wait for the operation to complete before returning.

Did you find this page helpful?