algolia search
Search the given index.
algolia search
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
-
--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
, andafterDistinct
.
. -
--facetingAfterDistinct
-
Forces faceting to be applied after de-duplication (with the distinct feature). Alternatively, the
afterDistinct
modifier ofattributesForFaceting
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
-
--filters
-
Filter the query with numeric, facet, or tag filters.
. -
--numericFilters
-
--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.
Iffalse
, maximum score is kept.
Iftrue
, score is summed.
. -
--tagFilters
Geo-Search
-
--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
andhighlightPostTag
). -
--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 thequeryLanguages
setting.
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set inqueryLanguages
. 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 byqueryLanguages
. 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
, andruleContexts
. 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 thequeryLanguages
setting.
list: language ISO codes for which stop words should be enabled. This list will override any values that you may have set inqueryLanguages
. 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 byqueryLanguages
. 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
andhitsPerPage
is the recommended method for paging results. However, you can useoffset
andlength
to implement an alternative approach to paging.
. -
--offset
-
Specifies the offset of the first hit to return.
Note: Using
page
andhitsPerPage
is the recommended method for paging results. However, you can useoffset
andlength
to implement an alternative approach to paging.
. -
--page
-
Page to retrieve (the first page is
0
, not1
).
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
anddesc
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.
Search
-
--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.