🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
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
13
14
15
# Search for objects in the "MOVIES" index matching the query "toy story"
$ algolia search MOVIES --query "toy story"

# Search for objects in the "MOVIES" index matching the query "toy story" with filters
$ algolia search MOVIES --query "toy story" --filters "'(genres:Animation OR genres:Family) AND original_language:en'"

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

# Search for objects in the "MOVIES" index matching the query "toy story" and export the response to a .json file
$ algolia search MOVIES --query "toy story" > movies.json

# Search for objects in the "MOVIES" index matching the query "toy story" and only export the results to a .json file
$ algolia search MOVIES --query "toy story" --output="jsonpath={$.Hits}" > movies.json

Advanced

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.

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

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

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

Incidates whether the search response includes detailed ranking information.

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

Precision of the proximity ranking criterion.

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

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.

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

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

Analytics

Indicates whether this query will be included in analytics.

Tags to apply to the query for segmenting analytics data.

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

Attributes

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

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

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

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

Maximum number of facet values to return for each facet.

Controls how facet values are fetched.

Filtering

Indicates whether this search will use Dynamic Re-Ranking.

Filter hits by facet value.
.

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

Filter on numeric attributes.
.

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.
.

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

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

Filter hits by tags.
.

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

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

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

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

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

Highlighting and Snippeting

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

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.
.

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

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 component word parts 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 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”).
.

Characters that the engine shouldn’t automatically normalize.

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.

Sets your user’s search language. This adjusts language-specific settings and features 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 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

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

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

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

Number of hits per page.

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.
.

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 to retrieve (the first page is 0, not 1).

Personalization

Incidates whether Personalization is enabled.

Defines how much Personalization affects results.

Associates a 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.

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

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

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

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

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

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

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. Use the asc and desc modifiers to specify the ranking order: ascending or descending.
.

Determines the order in which Algolia returns your results.

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

Rules

Incidates whether Rules are enabled.

Assigns rule contexts to search queries.

Text to search for in an index.

Overrides the query parameter and performs a more generic search.

Typos

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

Attributes for which you want to turn off typo tolerance.

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

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

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

Did you find this page helpful?