Algolia CLI / Commands

Search an index.

Usage
algolia search <index> [flags]

Search an index.

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Search for records in the "MOVIES" index matching the query "toy story"
$ algolia search MOVIES --query "toy story"

# Search for records 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 records 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 records 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 records 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

Whether the best matching attribute should be determined by minimum proximity.
See: https://www.algolia.com/doc/api-reference/api-parameters/attributeCriteriaComputedByMinProximity/

Determines how many records of a group are included in the search results.
See: https://www.algolia.com/doc/api-reference/api-parameters/distinct/

Whether to enable A/B testing for this search.
See: https://www.algolia.com/doc/api-reference/api-parameters/enableABTest/

Whether the search response should include detailed ranking information.
See: https://www.algolia.com/doc/api-reference/api-parameters/getRankingInfo/

Minimum proximity score for two matching words.
See: https://www.algolia.com/doc/api-reference/api-parameters/minProximity/

Whether to include this search when calculating processing-time percentiles.
See: https://www.algolia.com/doc/api-reference/api-parameters/percentileComputation/

Extra data that can be used in the search UI.
See: https://www.algolia.com/doc/api-reference/api-parameters/renderingContent/

Properties to include in the API response of search and browse requests.
See: https://www.algolia.com/doc/api-reference/api-parameters/responseFields/

Whether to take into account an index’s synonyms for this search.
See: https://www.algolia.com/doc/api-reference/api-parameters/synonyms/

Analytics

Whether this search will be included in Analytics.
See: https://www.algolia.com/doc/api-reference/api-parameters/analytics/

Tags to apply to the query for segmenting analytics data.
See: https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/

Whether to include a queryID attribute in the response.
See: https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/

Attributes

Attributes to include in the API response.
See: https://www.algolia.com/doc/api-reference/api-parameters/attributesToRetrieve/

Faceting

Whether faceting should be applied after deduplication with distinct.
See: https://www.algolia.com/doc/api-reference/api-parameters/facetingAfterDistinct/

Facets for which to retrieve facet values that match the search criteria and the number of matching facet values.
See: https://www.algolia.com/doc/api-reference/api-parameters/facets/

Maximum number of facet values to return for each facet.
See: https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/

Order in which to retrieve facet values.
See: https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/

Filtering

Whether this search will use Dynamic Re-Ranking.
See: https://www.algolia.com/doc/api-reference/api-parameters/enableReRanking/

Filter the search by facet values, so that only records with the same facet values are retrieved.
See: https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/

Filter expression to only include items that match the filter criteria in the response.
See: https://www.algolia.com/doc/api-reference/api-parameters/filters/

Filter by numeric facets.
See: https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/

Filters to promote or demote records in the search results.
See: https://www.algolia.com/doc/api-reference/api-parameters/optionalFilters/

Restricts a search to a subset of your searchable attributes.
See: https://www.algolia.com/doc/api-reference/api-parameters/restrictSearchableAttributes/

Whether to sum all filter scores.
See: https://www.algolia.com/doc/api-reference/api-parameters/sumOrFiltersScores/

Filter the search by values of the special _tags attribute.
See: https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/

Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude.
See: https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLng/

Whether to obtain the coordinates from the request’s IP address.
See: https://www.algolia.com/doc/api-reference/api-parameters/aroundLatLngViaIP/

Precision of a coordinate-based search in meters to group results with similar distances.
See: https://www.algolia.com/doc/api-reference/api-parameters/aroundPrecision/

Maximum radius for a search around a central location.
See: https://www.algolia.com/doc/api-reference/api-parameters/aroundRadius/

Minimum radius (in meters) for a search around a location when aroundRadius isn’t set.
See: https://www.algolia.com/doc/api-reference/api-parameters/minimumAroundRadius/

Highlighting and Snippeting

Attributes to highlight.
See: https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/

Attributes for which to enable snippets.
See: https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/

HTML tag to insert after the highlighted parts in all highlighted results and snippets.
See: https://www.algolia.com/doc/api-reference/api-parameters/highlightPostTag/

HTML tag to insert before the highlighted parts in all highlighted results and snippets.
See: https://www.algolia.com/doc/api-reference/api-parameters/highlightPreTag/

Whether to replace a highlighted word with the matched synonym.
See: https://www.algolia.com/doc/api-reference/api-parameters/replaceSynonymsInHighlight/

Whether to restrict highlighting and snippeting to items that at least partially matched the search query.
See: https://www.algolia.com/doc/api-reference/api-parameters/restrictHighlightAndSnippetArrays/

String used as an ellipsis indicator when a snippet is truncated.
See: https://www.algolia.com/doc/api-reference/api-parameters/snippetEllipsisText/

Languages

Whether to split compound words in the query into their building blocks.
See: https://www.algolia.com/doc/api-reference/api-parameters/decompoundQuery/

Treat singular, plurals, and other forms of declensions as equivalent.
See: https://www.algolia.com/doc/api-reference/api-parameters/ignorePlurals/

ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches).
See: https://www.algolia.com/doc/api-reference/api-parameters/naturalLanguages/

Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries.
See: https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/

Removes stop words from the search query.
See: https://www.algolia.com/doc/api-reference/api-parameters/removeStopWords/

Other flags

.
See: https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/

Words that should be considered optional when found in the query.
See: https://www.algolia.com/doc/api-reference/api-parameters/optionalWords/

.

Settings for the semantic search part of NeuralSearch.

Output formatting flags

If true, ignore errors in templates due to missing fields or map keys. This only applies to golang and jsonpath output formats.

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

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

Pagination

Number of hits per page.
See: https://www.algolia.com/doc/api-reference/api-parameters/hitsPerPage/

Number of hits to retrieve (used in combination with offset).
See: https://www.algolia.com/doc/api-reference/api-parameters/length/

Position of the first hit to retrieve.
See: https://www.algolia.com/doc/api-reference/api-parameters/offset/

Page of search results to retrieve.
See: https://www.algolia.com/doc/api-reference/api-parameters/page/

Personalization

Whether to enable Personalization.
See: https://www.algolia.com/doc/api-reference/api-parameters/enablePersonalization/

Impact that Personalization should have on this search.
See: https://www.algolia.com/doc/api-reference/api-parameters/personalizationImpact/

Unique pseudonymous or anonymous user identifier.
See: https://www.algolia.com/doc/api-reference/api-parameters/userToken/

Query strategy

Whether to support phrase matching and excluding words from search queries.
See: https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntax/

Advanced search syntax features you want to support.
See: https://www.algolia.com/doc/api-reference/api-parameters/advancedSyntaxFeatures/

Determine which plurals and synonyms should be considered an exact matches.
See: https://www.algolia.com/doc/api-reference/api-parameters/alternativesAsExact/

Searchable attributes for which you want to turn off the Exact ranking criterion.
See: https://www.algolia.com/doc/api-reference/api-parameters/disableExactOnAttributes/

Determines how the Exact ranking criterion is computed when the search query has only one word. One of: attribute, none, word.
See: https://www.algolia.com/doc/api-reference/api-parameters/exactOnSingleWordQuery/

Search mode the index will use to query for results. One of: neuralSearch, keywordSearch.
See: https://www.algolia.com/doc/api-reference/api-parameters/mode/

Determines if and how query words are interpreted as prefixes. One of: prefixLast, prefixAll, prefixNone.
See: https://www.algolia.com/doc/api-reference/api-parameters/queryType/

Strategy for removing words from the query when it doesn’t return any results. One of: none, lastWords, firstWords, allOptional.
See: https://www.algolia.com/doc/api-reference/api-parameters/removeWordsIfNoResults/

Ranking

Determines the order in which Algolia returns your results.
See: https://www.algolia.com/doc/api-reference/api-parameters/ranking/

Relevancy threshold below which less relevant results aren’t included in the results.
See: https://www.algolia.com/doc/api-reference/api-parameters/relevancyStrictness/

Rules

Whether to enable rules.
See: https://www.algolia.com/doc/api-reference/api-parameters/enableRules/

Assigns a rule context to the search query.
See: https://www.algolia.com/doc/api-reference/api-parameters/ruleContexts/

Search query.
See: https://www.algolia.com/doc/api-reference/api-parameters/query/

Keywords to be used instead of the search query to conduct a more broader search.
See: https://www.algolia.com/doc/api-reference/api-parameters/similarQuery/

Typos

Whether to allow typos on numbers in the search query.
See: https://www.algolia.com/doc/api-reference/api-parameters/allowTyposOnNumericTokens/

Attributes for which you want to turn off typo tolerance.
See: https://www.algolia.com/doc/api-reference/api-parameters/disableTypoToleranceOnAttributes/

Minimum number of characters a word in the search query must contain to accept matches with one typo.
See: https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor1Typo/

Minimum number of characters a word in the search query must contain to accept matches with two typos.
See: https://www.algolia.com/doc/api-reference/api-parameters/minWordSizefor2Typos/

Whether typo tolerance is enabled and how it is applied.
See: https://www.algolia.com/doc/api-reference/api-parameters/typoTolerance/

Did you find this page helpful?