Algolia CLI / Commands

Search the given index.

Usage
algolia search  <index> [flags]

Search the given index.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
# Search for objects in the "BOOKS" index matching the query "tolkien"
$ algolia search BOOKS --query "tolkien"

# Search for objects in the "BOOKS" index matching the query "tolkien" with filters
$ algolia search BOOKS --query "tolkien" --filters "'(category:Book OR category:Ebook) AND _tags:published'"

# Search for objects in the "BOOKS" index matching the query "tolkien" while setting the number of hits per page and specifying the page to retrieve
$ algolia search BOOKS --query "tolkien" --hitsPerPage 2 --page 4

# Search for objects in the "BOOKS" index matching the query "tolkien" and export the results to a new line delimited JSON (ndjson) file
$ algolia search BOOKS --query "tolkien" > books.ndjson

Advanced

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

Enables de-duplication or grouping of results.

Whether this search should participate in running AB tests.

Whether this search should use AI Re-Ranking.

Retrieve detailed ranking information.

Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100.

Precision of the proximity ranking criterion.

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

Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.

Choose which fields to return in the API response. This parameters applies to search and browse queries.

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

Analytics

Whether the current query will be taken into account in the Analytics.

List of tags to apply to the query for analytics purposes.

Enable the Click Analytics feature.

Attributes

This parameter controls which attributes to retrieve and which not to retrieve.

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

Faceting

The complete list of attributes that will be used for faceting.

Force faceting to be applied after de-duplication (via the Distinct setting).

Retrieve facets and their facet values.

Maximum number of facet values to return for each facet during a regular search.

Controls how facet values are fetched.

Filtering

Filter hits by facet value.

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

Filter on numeric attributes.

Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.

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

Determines how to calculate the total score for filtering.

Filter hits by tags.

Search for entries around a central geolocation, enabling a geo search within a circular area.

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

Precision of geo search (in meters), to add grouping by geo location to the ranking formula.

Define the maximum radius for a geo search (in meters).

Search inside a rectangular area (in geo coordinates).

Search inside a polygon (in geo coordinates).

Minimum radius (in meters) used for a geo search when aroundRadius is not set.

Highlighting and Snippeting

List of attributes to highlight.

List of attributes to snippet, with an optional maximum number of words to snippet.

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

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

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

Restrict highlighting and snippeting to items that matched the query.

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

Languages

Splits compound words into their composing atoms in the query.

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 functionality, where singulars and plurals are considered equivalent (foot = feet). The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages. false: disables ignore plurals, where singulars and plurals are not considered the same for matching purposes (foot will not find feet).
.

List of characters that the engine shouldn’t automatically normalize.

This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.

Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.

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 ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages. true: enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language, or those set by queryLanguages. false: disables stop word functionality, allowing stop words to be taken into account in a search.
.

Other flags

Name of the de-duplication attribute to be used with the distinct feature.

Output formatting flags

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.

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

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

Pagination

Set the number of hits per page.

Set the number of hits to retrieve (used only with offset).

Specify the offset of the first hit to return.

Specify the page to retrieve.

Personalization

Enable the Personalization feature.

Define the impact of the Personalization feature.

Associates a certain user token with the current search.

Query strategy

Enables the advanced query syntax.

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

List of alternatives that should be considered an exact match by the exact ranking criterion.

List of attributes on which you want to disable the exact ranking criterion.

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

A list of words that should be considered as optional when found in the query.

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

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

Ranking

Specifies the custom ranking criterion.

Controls how Algolia should sort your results.

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

Rules

Whether Rules should be globally enabled.

Enables contextual rules.

The text to search in the index.

Overrides the query parameter and performs a more generic search that can be used to find “similar” results.

Typos

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

List of attributes on which you want to disable typo tolerance.

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

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

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

Did you find this page helpful?