The generated API clients are a work in progress, you can also find our stable clients on the Algolia documentation.

Skip to main content

Search API (1.0.0)

Download OpenAPI specification:Download

The Algolia Search API lets you search, configure, and mange your indices and records.

Client libraries

Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. The official API clients are covered by Algolia's Service Level Agreement.

See: Algolia's ecosystem

Base URLs

The base URLs for requests to the Search API are:

  • https://{APPLICATION_ID}.algolia.net
  • https://{APPLICATION_ID}-dsn.algolia.net. If your subscription includes a Distributed Search Network, this ensures that requests are sent to servers closest to users.

Both URLs provide high availability by distributing requests with load balancing.

All requests must use HTTPS.

Retry strategy

To guarantee a high availability, implement a retry strategy for all API requests using the URLs of your servers as fallbacks:

  • https://{APPLICATION_ID}-1.algolianet.com
  • https://{APPLICATION_ID}-2.algolianet.com
  • https://{APPLICATION_ID}-3.algolianet.com

These URLs use a different DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers.

All Algolia API clients implement this retry strategy.

Authentication

To authenticate your API requests, add these headers:

  • x-algolia-application-id. Your Algolia application ID.
  • x-algolia-api-key. An API key with the necessary permissions to make the request. The required access control list (ACL) to make a request is listed in each endpoint's reference.

You can find your application ID and API key in the Algolia dashboard.

Request format

Depending on the endpoint, request bodies are either JSON objects or arrays of JSON objects,

Parameters

Parameters are passed as query parameters for GET and DELETE requests, and in the request body for POST and PUT requests.

Query parameters must be URL-encoded. Non-ASCII characters must be UTF-8 encoded. Plus characters (+) are interpreted as spaces. Arrays as query parameters must be one of:

  • A comma-separated string: attributesToRetrieve=title,description
  • A URL-encoded JSON array: attributesToRetrieve=%5B%22title%22,%22description%22%D

Response status and errors

The Search API returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response.

Successful responses return a 2xx status. Client errors return a 4xx status. Server errors are indicated by a 5xx status. Error responses have a message property with more information.

Version

The current version of the Search API is version 1, as indicated by the /1/ in each endpoint's URL.

Indices

Manage your indices and index settings.

Indices are copies of your data that are stored on Algolia's servers. They're optimal data structures for fast search and are made up of records and settings.

Delete an index

Deletes an index and all its settings.

  • Deleting an index doesn't delete its analytics data.
  • If you try to delete a non-existing index, the operation is ignored without warning.
  • If the index you want to delete has replica indices, the replicas become independent indices.
  • If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see Delete replica indices.
acl: ["deleteIndex"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteIndexAsync("theIndexName");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Retrieve index settings

Retrieves an object with non-null index settings.

acl: ["search"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetSettingsAsync("cts_e2e_settings");

Response samples

Content type
application/json
{
  • "attributesForFaceting": [
    ],
  • "replicas": [
    ],
  • "paginationLimitedTo": 100,
  • "unretrievableAttributes": [
    ],
  • "disableTypoToleranceOnWords": [
    ],
  • "attributesToTransliterate": [
    ],
  • "camelCaseAttributes": [
    ],
  • "decompoundedAttributes": {
    },
  • "indexLanguages": [
    ],
  • "disablePrefixOnAttributes": [
    ],
  • "allowCompressionOfIntegerArray": false,
  • "numericAttributesForFiltering": [
    ],
  • "separatorsToIndex": "+#",
  • "searchableAttributes": [
    ],
  • "userData": {
    },
  • "customNormalization": {
    },
  • "attributeForDistinct": "url",
  • "attributesToRetrieve": [
    ],
  • "ranking": [
    ],
  • "customRanking": [
    ],
  • "relevancyStrictness": 90,
  • "attributesToHighlight": [
    ],
  • "attributesToSnippet": [
    ],
  • "highlightPreTag": "<em>",
  • "highlightPostTag": "</em>",
  • "snippetEllipsisText": "…",
  • "restrictHighlightAndSnippetArrays": false,
  • "hitsPerPage": 20,
  • "minWordSizefor1Typo": 4,
  • "minWordSizefor2Typos": 8,
  • "typoTolerance": true,
  • "allowTyposOnNumericTokens": true,
  • "disableTypoToleranceOnAttributes": [
    ],
  • "ignorePlurals": [
    ],
  • "removeStopWords": [
    ],
  • "keepDiacriticsOnCharacters": "øé",
  • "queryLanguages": [
    ],
  • "decompoundQuery": true,
  • "enableRules": true,
  • "enablePersonalization": false,
  • "queryType": "prefixAll",
  • "removeWordsIfNoResults": "firstWords",
  • "mode": "keywordSearch",
  • "semanticSearch": {
    },
  • "advancedSyntax": false,
  • "optionalWords": [
    ],
  • "disableExactOnAttributes": [
    ],
  • "exactOnSingleWordQuery": "attribute",
  • "alternativesAsExact": [
    ],
  • "advancedSyntaxFeatures": [
    ],
  • "distinct": 1,
  • "replaceSynonymsInHighlight": false,
  • "minProximity": 1,
  • "responseFields": [
    ],
  • "maxFacetHits": 10,
  • "maxValuesPerFacet": 100,
  • "sortFacetValuesBy": "count",
  • "attributeCriteriaComputedByMinProximity": false,
  • "renderingContent": {
    },
  • "enableReRanking": true,
  • "reRankingApplyFilter": [
    ]
}

Update index settings

Update the specified index settings.

Index settings that you don't specify are left unchanged. Specify null to reset a setting to its default value.

For best performance, update the index settings before you add new records to your index.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Request Body schema: application/json
required
advancedSyntax
boolean
Default: false

Whether to support phrase matching and excluding words from search queries.

Use the advancedSyntaxFeatures parameter to control which feature is supported.

advancedSyntaxFeatures
Array of strings
Default: ["exactPhrase","excludeWords"]
Items Enum: "exactPhrase" "excludeWords"

Advanced search syntax features you want to support.

  • exactPhrase. Phrases in quotes must match exactly. For example, sparkly blue "iPhone case" only returns records with the exact string "iPhone case".

  • excludeWords. Query words prefixed with a - must not occur in a record. For example, search -engine matches records that contain "search" but not "engine".

This setting only has an effect if advancedSyntax is true.

allowCompressionOfIntegerArray
boolean
Default: false

Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.

allowTyposOnNumericTokens
boolean
Default: true

Whether to allow typos on numbers in the search query.

Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers.

alternativesAsExact
Array of strings
Default: ["ignorePlurals","singleWordSynonym"]
Items Enum: "ignorePlurals" "multiWordsSynonym" "singleWordSynonym"

Alternatives of query words that should be considered as exact matches by the Exact ranking criterion.

  • ignorePlurals. Plurals and similar declensions added by the ignorePlurals setting are considered exact matches.

  • singleWordSynonym. Single-word synonyms, such as "NY/NYC" are considered exact matches.

  • multiWordsSynonym. Multi-word synonyms, such as "NY/New York" are considered exact matches.

attributeCriteriaComputedByMinProximity
boolean
Default: false

Whether the best matching attribute should be determined by minimum proximity.

This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the ranking setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the searchableAttributes setting.

attributeForDistinct
string

Attribute that should be used to establish groups of results. Attribute names are case-sensitive.

All records with the same value for this attribute are considered a group. You can combine attributeForDistinct with the distinct search parameter to control how many items per group are included in the search results.

If you want to use the same attribute also for faceting, use the afterDistinct modifier of the attributesForFaceting setting. This applies faceting after deduplication, which will result in accurate facet counts.

attributesForFaceting
Array of strings
Default: []

Attributes used for faceting.

Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive.

Modifiers

  • filterOnly("ATTRIBUTE"). Allows using this attribute as a filter, but doesn't evalue the facet values.

  • searchable("ATTRIBUTE"). Allows searching for facet values.

  • afterDistinct("ATTRIBUTE"). Evaluates the facet count after deduplication with distinct. This ensures accurate facet counts. You can apply this modifier to searchable facets: afterDistinct(searchable(ATTRIBUTE)).

attributesToHighlight
Array of strings

Attributes to highlight.

By default, all searchable attributes are highlighted. Use * to highlight all attributes or use an empty array [] to turn off highlighting. Attribute names are case-sensitive.

With highlighting, strings that match the search query are surrounded by HTML tags defined by highlightPreTag and highlightPostTag. You can use this to visually highlight matching parts of a search query in your UI.

For more information, see Highlighting and snippeting.

attributesToRetrieve
Array of strings
Default: ["*"]

Attributes to include in the API response.

To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive.

  • * retrieves all attributes, except attributes included in the customRanking and unretrievableAttributes settings.
  • To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the *: ["*", "-ATTRIBUTE"].
  • The objectID attribute is always included.
attributesToSnippet
Array of strings
Default: []

Attributes for which to enable snippets. Attribute names are case-sensitive.

Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: ATTRIBUTE:NUMBER, where NUMBER is the number of words to be extracted.

attributesToTransliterate
Array of strings

Attributes, for which you want to support Japanese transliteration.

Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive.

camelCaseAttributes
Array of strings
Default: []

Attributes for which to split camel case words. Attribute names are case-sensitive.

object

Characters and their normalized replacements. This overrides Algolia's default normalization.

customRanking
Array of strings
Default: []

Attributes to use as custom ranking. Attribute names are case-sensitive.

The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.

Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order.

Modifiers

  • asc("ATTRIBUTE"). Sort the index by the values of an attribute, in ascending order.

  • desc("ATTRIBUTE"). Sort the index by the values of an attribute, in descending order.

If you use two or more custom ranking attributes, reduce the precision of your first attributes, or the other attributes will never be applied.

decompoundedAttributes
object
Default: {}

Searchable attributes to which Algolia should apply word segmentation (decompounding). Attribute names are case-sensitive.

Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, "firefighter". With decompounding, the individual components are indexed separately.

You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (nl), German (de), Finnish (fi), Danish (da), Swedish (sv), and Norwegian (no).

decompoundQuery
boolean
Default: true

Whether to split compound words into their building blocks.

For more information, see Word segmentation. Word segmentation is supported for these languages: German, Dutch, Finnish, Swedish, and Norwegian.

disableExactOnAttributes
Array of strings
Default: []

Searchable attributes for which you want to turn off the Exact ranking criterion. Attribute names are case-sensitive.

This can be useful for attributes with long values, where the likelyhood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.

disablePrefixOnAttributes
Array of strings
Default: []

Searchable attributes for which you want to turn off prefix matching. Attribute names are case-sensitive.

disableTypoToleranceOnAttributes
Array of strings
Default: []

Attributes for which you want to turn off typo tolerance. Attribute names are case-sensitive.

Returning only exact matches can help when:

  • Searching in hyphenated attributes.
  • Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions.

Consider alternatives such as disableTypoToleranceOnWords or adding synonyms if your attributes have intentional unusual spellings that might look like typos.

disableTypoToleranceOnWords
Array of strings
Default: []

Words for which you want to turn off typo tolerance. This also turns off word splitting and concatenation for the specified words.

boolean or integer

Determines how many records of a group are included in the search results.

Records with the same value for the attributeForDistinct attribute are considered a group. The distinct setting controls how many members of the group are returned. This is useful for deduplication and grouping.

The distinct setting is ignored if attributeForDistinct is not set.

enablePersonalization
boolean
Default: false

Whether to enable Personalization.

enableReRanking
boolean
Default: true

Whether this search will use Dynamic Re-Ranking.

This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.

enableRules
boolean
Default: true

Whether to enable rules.

exactOnSingleWordQuery
string
Default: "attribute"
Enum: "attribute" "none" "word"

Determines how the Exact ranking criterion is computed when the search query has only one word.

  • attribute. The Exact ranking criterion is 1 if the query word and attribute value are the same. For example, a search for "road" will match the value "road", but not "road trip".

  • none. The Exact ranking criterion is ignored on single-word searches.

  • word. The Exact ranking criterion is 1 if the query word is found in the attribute value. The query word must have at least 3 characters and must not be a stop word. Only exact matches will be highlighted, partial and prefix matches won't.

highlightPostTag
string
Default: "</em>"

HTML tag to insert after the highlighted parts in all highlighted results and snippets.

highlightPreTag
string
Default: "<em>"

HTML tag to insert before the highlighted parts in all highlighted results and snippets.

hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Number of hits per page.

Array of supportedLanguage (strings) or boolean

Treat singular, plurals, and other forms of declensions as equivalent. You should only use this feature for the languages used in your index.

indexLanguages
Array of strings
Default: []
Items Enum: "af" "ar" "az" "bg" "bn" "ca" "cs" "cy" "da" "de" "el" "en" "eo" "es" "et" "eu" "fa" "fi" "fo" "fr" "ga" "gl" "he" "hi" "hu" "hy" "id" "is" "it" "ja" "ka" "kk" "ko" "ku" "ky" "lt" "lv" "mi" "mn" "mr" "ms" "mt" "nb" "nl" "no" "ns" "pl" "ps" "pt" "pt-br" "qu" "ro" "ru" "sk" "sq" "sv" "sw" "ta" "te" "th" "tl" "tn" "tr" "tt" "uk" "ur" "uz" "zh"

Languages for language-specific processing steps, such as word detection and dictionary settings.

You should always specify an indexing language. If you don't specify an indexing language, the search engine uses all supported languages, or the languages you specified with the ignorePlurals or removeStopWords parameters. This can lead to unexpected search results. For more information, see Language-specific configuration.

keepDiacriticsOnCharacters
string
Default: ""

Characters for which diacritics should be preserved.

By default, Algolia removes diacritics from letters. For example, é becomes e. If this causes issues in your search, you can specify characters that should keep their diacritics.

maxFacetHits
integer <= 100
Default: 10

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

maxValuesPerFacet
integer <= 1000
Default: 100

Maximum number of facet values to return for each facet.

minProximity
integer [ 1 .. 7 ]
Default: 1

Minimum proximity score for two matching words.

This adjusts the Proximity ranking criterion by equally scoring matches that are farther apart.

For example, if minProximity is 2, neighboring matches and matches with one word between them would have the same score.

minWordSizefor1Typo
integer
Default: 4

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

minWordSizefor2Typos
integer
Default: 8

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

mode
string
Default: "keywordSearch"
Enum: "keywordSearch" "neuralSearch"

Search mode the index will use to query for results.

This setting only applies to indices, for which Algolia enabled NeuralSearch for you.

numericAttributesForFiltering
Array of strings
Default: []

Numeric attributes that can be used as numerical filters. Attribute names are case-sensitive.

By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes.

If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn't exist in your index, such as NO_NUMERIC_FILTERING.

Modifier

  • equalOnly("ATTRIBUTE"). Support only filtering based on equality comparisons = and !=.
optionalWords
Array of strings
Default: []

Words that should be considered optional when found in the query.

By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is "action video" and "video" is an optional word, the search engine runs two queries. One for "action video" and one for "action". Records that match all words are ranked higher.

For a search query with 4 or more words and all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records:

  • If optionalWords has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words.
  • If optionalWords has 10 or more words, the number of required matched words increases by the number of optional words dividied by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words.

For more information, see Optional words.

paginationLimitedTo
integer <= 20000
Default: 1000

Maximum number of search results that can be obtained through pagination.

Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can't be guaranteed.

queryLanguages
Array of strings
Default: []
Items Enum: "af" "ar" "az" "bg" "bn" "ca" "cs" "cy" "da" "de" "el" "en" "eo" "es" "et" "eu" "fa" "fi" "fo" "fr" "ga" "gl" "he" "hi" "hu" "hy" "id" "is" "it" "ja" "ka" "kk" "ko" "ku" "ky" "lt" "lv" "mi" "mn" "mr" "ms" "mt" "nb" "nl" "no" "ns" "pl" "ps" "pt" "pt-br" "qu" "ro" "ru" "sk" "sq" "sv" "sw" "ta" "te" "th" "tl" "tn" "tr" "tt" "uk" "ur" "uz" "zh"

Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries.

This setting sets a default list of languages used by the removeStopWords and ignorePlurals settings. This setting also sets a dictionary for word detection in the logogram-based CJK languages. To support this, you must place the CJK language first.

You should always specify a query language. If you don't specify an indexing language, the search engine uses all supported languages, or the languages you specified with the ignorePlurals or removeStopWords parameters. This can lead to unexpected search results. For more information, see Language-specific configuration.

queryType
string
Default: "prefixLast"
Enum: "prefixAll" "prefixLast" "prefixNone"

Determines if and how query words are interpreted as prefixes.

By default, only the last query word is treated as prefix (prefixLast). To turn off prefix search, use prefixNone. Avoid prefixAll, which treats all query words as prefixes. This might lead to counterintuitive results and makes your search slower.

For more information, see Prefix searching.

ranking
Array of strings
Default: ["typo","geo","words","filters","proximity","attribute","exact","custom"]

Determines the order in which Algolia returns your results.

By default, each entry corresponds to a ranking criteria. The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for sorting by an attribute, you put the sorting attribute at the top of the list.

Modifiers

  • asc("ATTRIBUTE"). Sort the index by the values of an attribute, in ascending order.
  • desc("ATTRIBUTE"). Sort the index by the values of an attribute, in descending order.

Before you modify the default setting, you should test your changes in the dashboard, and by A/B testing.

relevancyStrictness
integer
Default: 100

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

You can only set relevancyStrictness on virtual replica indices. Use this setting to strike a balance between the relevance and number of returned results.

Array of supportedLanguage (strings) or boolean

Removes stop words from the search query.

Stop words are common words like articles, conjunctions, prepositions, or pronouns that have little or no meaning on their own. In English, "the", "a", or "and" are stop words.

You should only use this feature for the languages used in your index.

removeWordsIfNoResults
string
Default: "none"
Enum: "allOptional" "firstWords" "lastWords" "none"

Strategy for removing words from the query when it doesn't return any results. This helps to avoid returning empty search results.

  • none. No words are removed when a query doesn't return results.

  • lastWords. Treat the last (then second to last, then third to last) word as optional, until there are results or at most 5 words have been removed.

  • firstWords. Treat the first (then second, then third) word as optional, until there are results or at most 5 words have been removed.

  • allOptional. Treat all words as optional.

For more information, see Remove words to improve results.

object

Extra data that can be used in the search UI.

You can use this to control aspects of your search UI, such as, the order of facet names and values without changing your frontend code.

replaceSynonymsInHighlight
boolean
Default: false

Whether to replace a highlighted word with the matched synonym.

By default, the original words are highlighted even if a synonym matches. For example, with home as a synonym for house and a search for home, records matching either "home" or "house" are included in the search results, and either "home" or "house" are highlighted.

With replaceSynonymsInHighlight set to true, a search for home still matches the same records, but all occurences of "house" are replaced by "home" in the highlighted response.

replicas
Array of strings
Default: []

Creates replica indices.

Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you'll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index.

Modifier

  • virtual("REPLICA"). Create a virtual replica, Virtual replicas don't increase the number of records and are optimized for Relevant sorting.
(Array of search filters (Array of search filter array (strings) or strings)) or string or null

Restrict Dynamic Re-Ranking to records that match these filters.

responseFields
Array of strings
Default: ["*"]

Properties to include in the API response of search and browse requests.

By default, all response properties are included. To reduce the response size, you can select, which attributes should be included.

You can't exclude these properties: message, warning, cursor, serverUsed, indexUsed, abTestVariantID, parsedQuery, or any property triggered by the getRankingInfo parameter.

Don't exclude properties that you might need in your search UI.

restrictHighlightAndSnippetArrays
boolean
Default: false

Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.

searchableAttributes
Array of strings
Default: []

Attributes used for searching. Attribute names are case-sensitive.

By default, all attributes are searchable and the Attribute ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of searchableAttributes rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as "title,alternate_title". Attributes with the same priority are always unordered.

For more information, see Searchable attributes.

Modifier

  • unordered("ATTRIBUTE"). Ignore the position of a match within the attribute.

Without modifier, matches at the beginning of an attribute rank higer than matches at the end.

object

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

separatorsToIndex
string
Default: ""

Controls which separators are indexed.

Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren't indexed. With separatorsToIndex, Algolia treats separator characters as separate words. For example, a search for C# would report two matches.

snippetEllipsisText
string
Default: "…"

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

sortFacetValuesBy
string
Default: "count"

Order in which to retrieve facet values.

  • count. Facet values are retrieved by decreasing count. The count is the number of matching records containing this facet value.

  • alpha. Retrieve facet values alphabetically.

This setting doesn't influence how facet values are displayed in your UI (see renderingContent). For more information, see facet value display.

boolean or typo tolerance (string)

Whether typo tolerance is enabled and how it is applied.

If typo tolerance is true, min, or strict, word splitting and concetenation is also active.

unretrievableAttributes
Array of strings
Default: []

Attributes that can't be retrieved at query time.

This can be useful if you want to use an attribute for ranking or to restrict access, but don't want to include it in the search results. Attribute names are case-sensitive.

userData
any
Default: {}

An object with custom data.

You can store up to 32 kB as custom data.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SetSettingsAsync(
  "cts_e2e_settings",
  new IndexSettings { PaginationLimitedTo = 10, },
  true
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Check task status

Checks the status of a given task.

Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server.

The indexing tasks' responses include a task ID that you can use to check the status.

acl: ["addObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

taskID
required
integer <int64>
Example: 1506303845001

Unique task identifier.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetTaskAsync("theIndexName", 123L);

Response samples

Content type
application/json
{
  • "status": "notPublished"
}

Copy or move an index

Copies or moves (renames) an index within the same Algolia application.

  • Existing destination indices are overwritten, except for index-specific API keys and analytics data.
  • If the destination index doesn't exist yet, it'll be created.

Copy

  • Copying a source index that doesn't exist creates a new index with 0 records and default settings.
  • The API keys of the source index are merged with the existing keys in the destination index.
  • You can't copy the enableReRanking, mode, and replicas settings.
  • You can't copy to a destination index that already has replicas.
  • Be aware of the size limits.
  • Related guide: Copy indices

Move

  • Moving a source index that doesn't exist is ignored without returning an error.
  • When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name.
  • If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices.
  • Related guide: Move indices.
acl: ["addObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
required
destination
required
string

Index name (case-sensitive).

operation
required
string
Enum: "copy" "move"

Operation to perform on the index.

scope
Array of strings
Items Enum: "rules" "settings" "synonyms"

Only for copying.

If you specify a scope, only the selected scopes are copied. Records and the other scopes are left unchanged. If you omit the scope parameter, everything is copied: records, settings, synonyms, and rules.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.OperationIndexAsync(
  "theIndexName",
  new OperationIndexParams
  {
    Operation = Enum.Parse<OperationType>("Copy"),
    Destination = "dest",
    Scope = new List<ScopeType>
    {
      Enum.Parse<ScopeType>("Rules"),
      Enum.Parse<ScopeType>("Settings")
    },
  }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

List indices

Lists all indices in the current Algolia application.

The request follows any index restrictions of the API key you use to make the request.

acl: ["listIndexes"]
query Parameters
hitsPerPage
integer
Default: 100

Number of hits per page.

integer or null
Default: null

Requested page of the API response. If null, the API response is not paginated.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ListIndicesAsync();

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "nbPages": 100
}

Records

Add, update, and delete records from your indices.

Records are individual items in your index. When they match a search query, they're returned as search results, in the order determined by your ranking. Records are schemaless JSON objects.

Add or replace a record

Adds a record to an index or replace it.

  • If the record doesn't have an object ID, a new record with an auto-generated object ID is added to your index.
  • If a record with the specified object ID exists, the existing record is replaced.
  • If a record with the specified object ID doesn't exist, a new record is added to your index.
  • If you add a record to an index that doesn't exist yet, a new index is created.

To update some attributes of a record, use the partial operation. To add, update, or replace multiple records, use the batch operation.

acl: ["addObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
required

The record, a schemaless object with attributes that are useful in the context of search and discovery.

object

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SaveObjectAsync(
  "theIndexName",
  new Dictionary<string, string> { { "objectID", "id" }, { "test", "val" } }
);

Response samples

Content type
application/json
{
  • "createdAt": "2023-07-04T12:49:15Z",
  • "taskID": 1514562690001,
  • "objectID": "test-record-123"
}

Retrieve a record

Retrieves one record by its object ID.

To retrieve more than one record, use the objects operation.

acl: ["search"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: test-record-123

Unique record identifier.

query Parameters
attributesToRetrieve
Array of strings

Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned.

objectID is always retrieved.

Attributes included in unretrievableAttributes won't be retrieved unless the request is authenticated with the admin API key.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetObjectAsync(
  "theIndexName",
  "uniqueID",
  new List<string> { "attr1", "attr2" }
);

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

Add or replace a record

If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index.

To update some attributes of an existing record, use the partial operation instead. To add, update, or replace multiple records, use the batch operation.

acl: ["addObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: test-record-123

Unique record identifier.

Request Body schema: application/json
required

The record, a schemaless object with attributes that are useful in the context of search and discovery.

object

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.AddOrUpdateObjectAsync(
  "indexName",
  "uniqueID",
  new Dictionary<string, string> { { "key", "value" } }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z",
  • "objectID": "test-record-123"
}

Delete a record

Deletes a record by its object ID.

To delete more than one record, use the batch operation. To delete records matching a query, use the deleteByQuery operation.

acl: ["deleteObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: test-record-123

Unique record identifier.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteObjectAsync("theIndexName", "uniqueID");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Delete records matching a query

This operation doesn't accept empty queries or filters.

It's more efficient to get a list of object IDs with the browse operation, and then delete the records using the batch operation.

acl: ["deleteIndex"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
required
aroundLatLng
string
Default: ""

Coordinates for the center of a circle, expressed as a comma-separated string of latitude and longitude.

Only records included within circle around this central location are included in the results. The radius of the circle is determined by the aroundRadius and minimumAroundRadius settings. This parameter is ignored if you also specify insidePolygon or insideBoundingBox.

integer or all (string)

Maximum radius for a search around a central location.

This parameter works in combination with the aroundLatLng and aroundLatLngViaIP parameters. By default, the search radius is determined automatically from the density of hits around the central location. The search radius is small if there are many hits close to the central coordinates.

(Array of search filters (Array of search filter array (strings) or strings)) or string

Filter the search by facet values, so that only records with the same facet values are retrieved.

Prefer using the filters parameter, which supports all filter types and combinations with boolean operators.

  • [filter1, filter2] is interpreted as filter1 AND filter2.
  • [[filter1, filter2], filter3] is interpreted as filter1 OR filter2 AND filter3.
  • facet:-value is interpreted as NOT facet:value.

While it's best to avoid attributes that start with a -, you can still filter them by escaping with a backslash: facet:\-value.

filters
string

Filter expression to only include items that match the filter criteria in the response.

You can use these filter expressions:

  • Numeric filters. <facet> <op> <number>, where <op> is one of <, <=, =, !=, >, >=.
  • Ranges. <facet>:<lower> TO <upper> where <lower> and <upper> are the lower and upper limits of the range (inclusive).
  • Facet filters. <facet>:<value> where <facet> is a facet attribute (case-sensitive) and <value> a facet value.
  • Tag filters. _tags:<value> or just <value> (case-sensitive).
  • Boolean filters. <facet>: true | false.

You can combine filters with AND, OR, and NOT operators with the following restrictions:

  • You can only combine filters of the same type with OR. Not supported: facet:value OR num > 3.
  • You can't use NOT with combinations of filters. Not supported: NOT(facet:value OR facet:value)
  • You can't combine conjunctions (AND) with OR. Not supported: facet:value OR (facet:value AND facet:value)

Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (OR, AND, NOT), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array.

For more information, see Filters.

insideBoundingBox
Array of numbers[ items <double > = 4 items [ items <double > ] ]

Coordinates for a rectangular area in which to search.

Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: [p1 lat, p1 long, p2 lat, p2 long]. Provide multiple bounding boxes as nested arrays. For more information, see rectangular area.

insidePolygon
Array of numbers[ items <double > [ 6 .. 20000 ] items [ items <double > ] ]

Coordinates of a polygon in which to search.

Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see filtering inside polygons. This parameter is ignored if you also specify insideBoundingBox.

(Array of search filters (Array of search filter array (strings) or strings)) or string

Filter by numeric facets.

Prefer using the filters parameter, which supports all filter types and combinations with boolean operators.

You can use numeric comparison operators: <, <=, =, !=, >, >=. Comparsions are precise up to 3 decimals. You can also provide ranges: facet:<lower> TO <upper>. The range includes the lower and upper boundaries. The same combination rules apply as for facetFilters.

(Array of search filters (Array of search filter array (strings) or strings)) or string

Filter the search by values of the special _tags attribute.

Prefer using the filters parameter, which supports all filter types and combinations with boolean operators.

Different from regular facets, _tags can only be used for filtering (including or excluding records). You won't get a facet count. The same combination and escaping rules apply as for facetFilters.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteByAsync(
  "theIndexName",
  new DeleteByParams { Filters = "brand:brandName", }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Delete all records from an index

Deletes only the records from an index while keeping settings, synonyms, and rules.

acl: ["deleteIndex"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ClearObjectsAsync("theIndexName");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Add or update attributes

Adds new attributes to a record, or update existing ones.

  • If a record with the specified object ID doesn't exist, a new record is added to the index if createIfNotExists is true.
  • If the index doesn't exist yet, this method creates a new index.
  • You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor.
acl: ["addObject"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: test-record-123

Unique record identifier.

query Parameters
createIfNotExists
boolean
Default: true

Whether to create a new record if it doesn't exist.

Request Body schema: application/json
required

Attributes with their values.

additional property
attribute (string) or builtInOperation (object)
One of
string

Value of the attribute to update.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.PartialUpdateObjectAsync(
  "theIndexName",
  "uniqueID",
  new Dictionary<string, AttributeToUpdate>
  {
    { "id1", new AttributeToUpdate("test") },
    {
      "id2",
      new AttributeToUpdate(
        new BuiltInOperation
        {
          Operation = Enum.Parse<BuiltInOperationType>("AddUnique"),
          Value = "test2",
        }
      )
    }
  },
  true
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z",
  • "objectID": "test-record-123"
}

Batch indexing operations on one index

Adds, updates, or deletes records in one index with a single API request.

Batching index updates reduces latency and increases data integrity.

  • Actions are applied in the order they're specified.
  • Actions are equivalent to the individual API requests of the same name.
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
required
required
Array of objects
Array
action
required
string
Enum: "addObject" "clear" "delete" "deleteObject" "partialUpdateObject" "partialUpdateObjectNoCreate" "updateObject"

Type of indexing operation.

body
required
object

Operation arguments (varies with specified action).

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.BatchAsync(
  "theIndexName",
  new BatchWriteParams
  {
    Requests = new List<BatchRequest>
    {
      new BatchRequest
      {
        Action = Enum.Parse<Action>("AddObject"),
        Body = new Dictionary<string, string> { { "key", "value" } },
      }
    },
  }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "objectIDs": [
    ]
}

Batch indexing operations on multiple indices

Adds, updates, or deletes records in multiple indices with a single API request.

  • Actions are applied in the order they are specified.
  • Actions are equivalent to the individual API requests of the same name.
Request Body schema: application/json
required
required
Array of objects
Array
action
required
string
Enum: "addObject" "clear" "delete" "deleteObject" "partialUpdateObject" "partialUpdateObjectNoCreate" "updateObject"

Type of indexing operation.

body
required
object

Operation arguments (varies with specified action).

indexName
required
string

Index name (case-sensitive).

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.MultipleBatchAsync(
  new BatchParams
  {
    Requests = new List<MultipleBatchRequest>
    {
      new MultipleBatchRequest
      {
        Action = Enum.Parse<Action>("AddObject"),
        Body = new Dictionary<string, string> { { "key", "value" } },
        IndexName = "theIndexName",
      }
    },
  }
);

Response samples

Content type
application/json
{
  • "taskID": {
    },
  • "objectIDs": [
    ]
}

Retrieve records

Retrieves one or more records, potentially from different indices.

Records are returned in the same order as the requests.

acl: ["search"]
Request Body schema: application/json
required

Request object.

required
Array of objects
Array
indexName
required
string

Index from which to retrieve the records.

objectID
required
string

Object ID for the record to retrieve.

attributesToRetrieve
Array of strings

Attributes to retrieve. If not specified, all retrievable attributes are returned.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetObjectsAsync<Object>(
  new GetObjectsParams
  {
    Requests = new List<GetObjectsRequest>
    {
      new GetObjectsRequest
      {
        AttributesToRetrieve = new List<string> { "attr1", "attr2" },
        ObjectID = "uniqueID",
        IndexName = "theIndexName",
      }
    },
  }
);

Response samples

Content type
application/json
{
  • "results": [
    ]
}

Search

Search one or more indices for matching records or facet values.

Search an index

Searches a single index and return matching search results (hits).

This method lets you retrieve up to 1,000 hits. If you need more, use the browse operation or increase the paginatedLimitedTo index setting.

acl: ["search"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
One of
params
string
Default: ""

Search parameters as a URL-encoded query string.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchSingleIndexAsync<Object>("indexName");

Response samples

Content type
application/json
{
  • "abTestID": 0,
  • "abTestVariantID": 1,
  • "aroundLatLng": "40.71,-74.01",
  • "automaticRadius": "string",
  • "exhaustive": {
    },
  • "exhaustiveFacetsCount": true,
  • "exhaustiveNbHits": true,
  • "exhaustiveTypo": true,
  • "facets": {
    },
  • "facets_stats": {
    },
  • "hitsPerPage": 20,
  • "index": "indexName",
  • "indexUsed": "indexNameAlt",
  • "message": "string",
  • "nbHits": 20,
  • "nbPages": 1,
  • "nbSortedHits": 20,
  • "page": 0,
  • "parsedQuery": "george clo",
  • "processingTimeMS": 20,
  • "processingTimingsMS": { },
  • "queryAfterRemoval": "string",
  • "redirect": {
    },
  • "renderingContent": {
    },
  • "serverTimeMS": 20,
  • "serverUsed": "c2-uk-3.algolia.net",
  • "userData": {
    },
  • "queryID": "a00dbc80a8d13c4565a442e7e2dca80a",
  • "hits": [
    ],
  • "query": "",
  • "params": "query=a&hitsPerPage=20"
}

Search multiple indices

Sends multiple search request to one or more indices.

This can be useful in these cases:

  • Different indices for different purposes, such as, one index for products, another one for marketing content.
  • Multiple searches to the same index—for example, with different filters.
acl: ["search"]
Request Body schema: application/json
required

Muli-search request body. Results are returned in the same order as the requests.

required
Array of (SearchForHits (Search parameters as query string (object) or Search parameters as object (object))) or (SearchForFacets (Search parameters as query string (object) or Search parameters as object (object)))
strategy
string
Enum: "none" "stopIfEnoughMatches"

Strategy for multiple search queries:

  • none. Run all queries.
  • stopIfEnoughMatches. Run the queries one by one, stopping as soon as a query matches at least the hitsPerPage number of results.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchAsync<Object>(
  new SearchMethodParams
  {
    Requests = new List<SearchQuery>
    {
      new SearchQuery(new SearchForHits { IndexName = "cts_e2e_search_empty_index", })
    },
  }
);

Response samples

Content type
application/json
{
  • "results": [
    ]
}

Search for facet values

Searches for values of a specified facet attribute.

  • By default, facet values are sorted by decreasing count. You can adjust this with the sortFacetValueBy parameter.
  • Searching for facet values doesn't work if you have more than 65 searchable facets and searchable attributes combined.
acl: ["search"]
path Parameters
facetName
required
string

Facet attribute in which to search for values.

This attribute must be included in the attributesForFaceting index setting with the searchable() modifier.

indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
facetQuery
string
Default: ""

Text to search inside the facet's values.

maxFacetHits
integer <= 100
Default: 10

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

params
string
Default: ""

Search parameters as a URL-encoded query string.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchForFacetValuesAsync("indexName", "facetName");

Response samples

Content type
application/json
{
  • "facetHits": [
    ],
  • "exhaustiveFacetsCount": true,
  • "processingTimeMS": 20
}

Browse for records

Retrieves records from an index, up to 1,000 per request.

While searching retrieves hits (records augmented with attributes for highlighting and ranking details), browsing just returns matching records. This can be useful if you want to export your indices.

  • The Analytics API doesn't collect data when using browse.
  • Records are ranked by attributes and custom ranking.
  • Deduplication (distinct) is turned off.
  • There's no ranking for: typo-tolerance, number of matched words, proximity, geo distance.
acl: ["browse"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
One of
params
string
Default: ""

Search parameters as a URL-encoded query string.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.BrowseAsync<Object>("cts_e2e_browse");

Response samples

Content type
application/json
{
  • "abTestID": 0,
  • "abTestVariantID": 1,
  • "aroundLatLng": "40.71,-74.01",
  • "automaticRadius": "string",
  • "exhaustive": {
    },
  • "exhaustiveFacetsCount": true,
  • "exhaustiveNbHits": true,
  • "exhaustiveTypo": true,
  • "facets": {
    },
  • "facets_stats": {
    },
  • "hitsPerPage": 20,
  • "index": "indexName",
  • "indexUsed": "indexNameAlt",
  • "message": "string",
  • "nbHits": 20,
  • "nbPages": 1,
  • "nbSortedHits": 20,
  • "page": 0,
  • "parsedQuery": "george clo",
  • "processingTimeMS": 20,
  • "processingTimingsMS": { },
  • "queryAfterRemoval": "string",
  • "redirect": {
    },
  • "renderingContent": {
    },
  • "serverTimeMS": 20,
  • "serverUsed": "c2-uk-3.algolia.net",
  • "userData": {
    },
  • "queryID": "a00dbc80a8d13c4565a442e7e2dca80a",
  • "hits": [
    ],
  • "query": "",
  • "params": "query=a&hitsPerPage=20",
  • "cursor": "jMDY3M2MwM2QwMWUxMmQwYWI0ZTN"
}

Rules

Create, update, delete, and search for rules.

Rules are if-then statements that you can use to curate search results. Rules have conditions which can trigger consequences. Consequences are changes to the search results, such as changing the order of search results, or boosting a facet. This can be useful for tuning specific queries or for merchandising.

Retrieve a rule

Retrieves a rule by its ID. To find the object ID of rules, use the search operation.

acl: ["settings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string

Unique identifier of a rule object.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetRuleAsync("indexName", "id1");

Response samples

Content type
application/json
{
  • "objectID": "string",
  • "conditions": [
    ],
  • "consequence": {
    },
  • "description": "Display a promotional banner",
  • "enabled": true,
  • "validity": [
    ]
}

Create or replace a rule

If a rule with the specified object ID doesn't exist, it's created. Otherwise, the existing rule is replaced.

To create or update more than one rule, use the batch operation.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string

Unique identifier of a rule object.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Request Body schema: application/json
required
objectID
required
string

Unique identifier of a rule object.

Array of objects [ 0 .. 25 ] items

Conditions that trigger a rule.

Some consequences require specific conditions or don't require any condition. For more information, see Conditions.

object

Effect of the rule.

For more information, see Consequences.

description
string

Description of the rule's purpose to help you distinguish between different rules.

enabled
boolean
Default: true

Whether the rule is active.

Array of objects

Time periods when the rule is active.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SaveRuleAsync(
  "indexName",
  "id1",
  new Rule
  {
    ObjectID = "id1",
    Conditions = new List<Condition>
    {
      new Condition { Pattern = "apple", Anchoring = Enum.Parse<Anchoring>("Contains"), }
    },
  }
);

Response samples

Content type
application/json
{
  • "objectID": "string",
  • "updatedAt": "2023-07-04T12:49:15Z",
  • "taskID": 1514562690001
}

Delete a rule

Deletes a rule by its ID. To find the object ID for rules, use the search operation.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string

Unique identifier of a rule object.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteRuleAsync("indexName", "id1");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Create or update rules

Create or update multiple rules.

If a rule with the specified object ID doesn't exist, Algolia creates a new one. Otherwise, existing rules are replaced.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

query Parameters
clearExistingRules
boolean

Whether existing rules should be deleted before adding this batch.

forwardToReplicas
boolean

Whether changes are applied to replica indices.

Request Body schema: application/json
required
Array
objectID
required
string

Unique identifier of a rule object.

Array of objects [ 0 .. 25 ] items

Conditions that trigger a rule.

Some consequences require specific conditions or don't require any condition. For more information, see Conditions.

object

Effect of the rule.

For more information, see Consequences.

description
string

Description of the rule's purpose to help you distinguish between different rules.

enabled
boolean
Default: true

Whether the rule is active.

Array of objects

Time periods when the rule is active.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SaveRulesAsync(
  "indexName",
  new List<Rule>
  {
    new Rule
    {
      ObjectID = "a-rule-id",
      Conditions = new List<Condition>
      {
        new Condition { Pattern = "smartphone", Anchoring = Enum.Parse<Anchoring>("Contains"), }
      },
    },
    new Rule
    {
      ObjectID = "a-second-rule-id",
      Conditions = new List<Condition>
      {
        new Condition { Pattern = "apple", Anchoring = Enum.Parse<Anchoring>("Contains"), }
      },
    }
  }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Delete all rules

Deletes all rules from the index.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ClearRulesAsync("indexName");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Search for rules

Searches for rules in your index.

acl: ["settings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json
anchoring
string
Enum: "contains" "endsWith" "is" "startsWith"

Which part of the search query the pattern should match:

  • startsWith. The pattern must match the begginning of the query.
  • endsWith. The pattern must match the end of the query.
  • is. The pattern must match the query exactly.
  • contains. The pattern must match anywhere in the query.

Empty queries are only allowed as pattern with anchoring: is.

context
string

Only return rules that match the context (exact match).

boolean or null
Default: null
hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Maximum number of hits per page.

page
integer >= 0

Requested page of the API response.

query
string
Default: ""

Search query for rules.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchRulesAsync(
  "indexName",
  new SearchRulesParams { Query = "something", }
);

Response samples

Content type
application/json
{
  • "hits": [
    ],
  • "nbHits": 0,
  • "page": 0,
  • "nbPages": 0
}

Synonyms

Create, update, delete, and search for synonyms.

Synonyms are terms that the search engine should consider equal.

Retrieve a synonym

Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the search operation.

acl: ["settings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: synonymID

Unique identifier of a synonym object.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetSynonymAsync("indexName", "id1");

Response samples

Content type
application/json
{
  • "objectID": "synonymID",
  • "type": "onewaysynonym",
  • "synonyms": [
    ],
  • "input": "car",
  • "word": "car",
  • "corrections": [
    ],
  • "placeholder": "<Street>",
  • "replacements": [
    ]
}

Create or replace a synonym

If a synonym with the specified object ID doesn't exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the batch operation.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: synonymID

Unique identifier of a synonym object.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Request Body schema: application/json
required
objectID
required
string

Unique identifier of a synonym object.

type
required
string
Enum: "altcorrection1" "altcorrection2" "onewaysynonym" "placeholder" "synonym"

Synonym type.

corrections
Array of strings

Words to be matched in records.

input
string

Word or phrase to appear in query strings (for onewaysynonyms).

placeholder
string

Placeholder token to be put inside records.

replacements
Array of strings

Query words that will match the placeholder token.

synonyms
Array of strings

Words or phrases considered equivalent.

word
string

Word or phrase to appear in query strings (for altcorrection1 and altcorrection2).

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SaveSynonymAsync(
  "indexName",
  "id1",
  new SynonymHit
  {
    ObjectID = "id1",
    Type = Enum.Parse<SynonymType>("Synonym"),
    Synonyms = new List<string> { "car", "vehicule", "auto" },
  },
  true
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z",
  • "id": "12"
}

Delete a synonym

Deletes a synonym by its ID. To find the object IDs of your synonyms, use the search operation.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

objectID
required
string
Example: synonymID

Unique identifier of a synonym object.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteSynonymAsync("indexName", "id1");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Create or replace synonyms

If a synonym with the objectID doesn't exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

replaceExistingSynonyms
boolean

Whether to replace all synonyms in the index with the ones sent with this request.

Request Body schema: application/json
required
Array
objectID
required
string

Unique identifier of a synonym object.

type
required
string
Enum: "altcorrection1" "altcorrection2" "onewaysynonym" "placeholder" "synonym"

Synonym type.

corrections
Array of strings

Words to be matched in records.

input
string

Word or phrase to appear in query strings (for onewaysynonyms).

placeholder
string

Placeholder token to be put inside records.

replacements
Array of strings

Query words that will match the placeholder token.

synonyms
Array of strings

Words or phrases considered equivalent.

word
string

Word or phrase to appear in query strings (for altcorrection1 and altcorrection2).

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SaveSynonymsAsync(
  "indexName",
  new List<SynonymHit>
  {
    new SynonymHit
    {
      ObjectID = "id1",
      Type = Enum.Parse<SynonymType>("Synonym"),
      Synonyms = new List<string> { "car", "vehicule", "auto" },
    },
    new SynonymHit
    {
      ObjectID = "id2",
      Type = Enum.Parse<SynonymType>("Onewaysynonym"),
      Input = "iphone",
      Synonyms = new List<string> { "ephone", "aphone", "yphone" },
    }
  },
  true,
  false
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Delete all synonyms

Deletes all synonyms from the index.

acl: ["editSettings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

query Parameters
forwardToReplicas
boolean

Whether changes are applied to replica indices.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ClearSynonymsAsync("indexName");

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Search for synonyms

Searches for synonyms in your index.

acl: ["settings"]
path Parameters
indexName
required
string
Example: YourIndexName

Name of the index on which to perform the operation.

Request Body schema: application/json

Body of the searchSynonyms operation.

hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Number of hits per page.

page
integer >= 0
Default: 0

Page of search results to retrieve.

query
string
Default: ""

Search query.

type
string
Enum: "altcorrection1" "altcorrection2" "onewaysynonym" "placeholder" "synonym"

Synonym type.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchSynonymsAsync("indexName");

Response samples

Content type
application/json
{
  • "hits": [
    ],
  • "nbHits": 20
}

Dictionaries

Manage your dictionaries.

Customize language-specific settings, such as stop words, plurals, or word segmentation.

Dictionaries are application-wide.

Add or delete dictionary entries

Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.

acl: ["editSettings"]
path Parameters
dictionaryName
required
string
Enum: "compounds" "plurals" "stopwords"

Dictionary type in which to search.

Request Body schema: application/json
required
required
Array of objects

List of additions and deletions to your dictionaries.

clearExistingDictionaryEntries
boolean
Default: false

Whether to replace all custom entries in the dictionary with the ones sent with this request.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.BatchDictionaryEntriesAsync(
  Enum.Parse<DictionaryType>("Compounds"),
  new BatchDictionaryEntriesParams
  {
    Requests = new List<BatchDictionaryEntriesRequest>
    {
      new BatchDictionaryEntriesRequest
      {
        Action = Enum.Parse<DictionaryAction>("AddEntry"),
        Body = new DictionaryEntry
        {
          ObjectID = "1",
          Language = Enum.Parse<SupportedLanguage>("En"),
        },
      },
      new BatchDictionaryEntriesRequest
      {
        Action = Enum.Parse<DictionaryAction>("DeleteEntry"),
        Body = new DictionaryEntry
        {
          ObjectID = "2",
          Language = Enum.Parse<SupportedLanguage>("Fr"),
        },
      }
    },
  }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Search dictionary entries

Searches for standard and custom dictionary entries.

acl: ["settings"]
path Parameters
dictionaryName
required
string
Enum: "compounds" "plurals" "stopwords"

Dictionary type in which to search.

Request Body schema: application/json
required
query
required
string
Default: ""

Search query.

hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Number of hits per page.

language
string
Enum: "af" "ar" "az" "bg" "bn" "ca" "cs" "cy" "da" "de" "el" "en" "eo" "es" "et" "eu" "fa" "fi" "fo" "fr" "ga" "gl" "he" "hi" "hu" "hy" "id" "is" "it" "ja" "ka" "kk" "ko" "ku" "ky" "lt" "lv" "mi" "mn" "mr" "ms" "mt" "nb" "nl" "no" "ns" "pl" "ps" "pt" "pt-br" "qu" "ro" "ru" "sk" "sq" "sv" "sw" "ta" "te" "th" "tl" "tn" "tr" "tt" "uk" "ur" "uz" "zh"

ISO code for a supported language.

page
integer >= 0
Default: 0

Page of search results to retrieve.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchDictionaryEntriesAsync(
  Enum.Parse<DictionaryType>("Stopwords"),
  new SearchDictionaryEntriesParams { Query = "about", }
);

Response samples

Content type
application/json
{
  • "hits": [
    ],
  • "page": 0,
  • "nbHits": 20,
  • "nbPages": 1
}

Retrieve dictionary settings

Retrieves the languages for which standard dictionary entries are turned off.

acl: ["settings"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetDictionarySettingsAsync();

Response samples

Content type
application/json
{
  • "disableStandardEntries": {
    }
}

Update dictionary settings

Turns standard stop word dictionary entries on or off for a given language.

acl: ["editSettings"]
Request Body schema: application/json
required
required
object

Key-value pairs of supported language ISO codes and boolean values.

object or null
object or null
object or null

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SetDictionarySettingsAsync(
  new DictionarySettingsParams
  {
    DisableStandardEntries = new StandardEntries
    {
      Plurals = new Dictionary<string, Boolean>
      {
        { "fr", false },
        { "en", false },
        { "ru", true }
      },
    },
  }
);

Response samples

Content type
application/json
{
  • "taskID": 1514562690001,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

List available languages

Lists supported languages with their supported dictionary types and number of custom entries.

acl: ["settings"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetDictionaryLanguagesAsync();

Response samples

Content type
application/json
{
  • "language1": {
    },
  • "language2": {
    }
}

API keys

Manage your API keys.

API requests must be authenticated with an API key. API keys can have permissions (access control lists, ACL) and restrictions.

List API keys

Lists all API keys associated with your Algolia application, including their permissions and restrictions.

acl: ["admin"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ListApiKeysAsync();

Response samples

Content type
application/json
{
  • "keys": [
    ]
}

Create an API key

Creates a new API key with specific permissions and restrictions.

acl: ["admin"]
Request Body schema: application/json
required
acl
required
Array of strings
Default: []
Items Enum: "addObject" "analytics" "browse" "deleteIndex" "deleteObject" "editSettings" "inference" "listIndexes" "logs" "personalization" "recommendation" "search" "seeUnretrievableAttributes" "settings" "usage"

Permissions that determine the type of API requests this key can make. The required ACL is listed in each endpoint's reference. For more information, see access control list.

description
string
Default: ""

Description of an API key to help you identify this API key.

indexes
Array of strings
Default: []

Index names or patterns that this API key can access. By default, an API key can access all indices in the same application.

You can use leading and trailing wildcard characters (*):

  • dev_* matches all indices starting with "dev_".
  • *_dev matches all indices ending with "_dev".
  • *_products_* matches all indices containing "products".
maxHitsPerQuery
integer
Default: 0

Maximum number of results this API key can retrieve in one query. By default, there's no limit.

maxQueriesPerIPPerHour
integer
Default: 0

Maximum number of API requests allowed per IP address or user token per hour.

If this limit is reached, the API returns an error with status code 429. By default, there's no limit.

queryParameters
string
Default: ""

Query parameters to add when making API requests with this API key.

To restrict this API key to specific IP addresses, add the restrictSources parameter. You can only add a single source, but you can provide a range of IP addresses.

Creating an API key fails if the request is made from an IP address that's outside the restricted range.

referers
Array of strings
Default: []

Allowed HTTP referrers for this API key.

By default, all referrers are allowed. You can use leading and trailing wildcard characters (*):

  • https://algolia.com/* allows all referrers starting with "https://algolia.com/"
  • *.algolia.com allows all referrers ending with ".algolia.com"
  • *algolia.com* allows all referrers in the domain "algolia.com".

Like all HTTP headers, referrers can be spoofed. Don't rely on them to secure your data. For more information, see HTTP referrer restrictions.

validity
integer
Default: 0

Duration (in seconds) after which the API key expires. By default, API keys don't expire.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.AddApiKeyAsync(
  new ApiKey
  {
    Acl = new List<Acl> { Enum.Parse<Acl>("Search"), Enum.Parse<Acl>("AddObject") },
    Description = "my new api key",
    Validity = 300,
    MaxQueriesPerIPPerHour = 100,
    MaxHitsPerQuery = 20,
  }
);

Response samples

Content type
application/json
{
  • "key": "13ad45b4d0a2f6ea65ecbddf6aa260f2",
  • "createdAt": "2023-07-04T12:49:15Z"
}

Retrieve API key permissions

Gets the permissions and restrictions of an API key.

When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key.

path Parameters
key
required
string
Example: YourAPIKey

API key.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetApiKeyAsync("myTestApiKey");

Response samples

Content type
application/json
{
  • "value": "13ad45b4d0a2f6ea65ecbddf6aa260f2",
  • "createdAt": 1656345570000,
  • "acl": [
    ],
  • "description": "Used for indexing by the CLI",
  • "indexes": [
    ],
  • "maxHitsPerQuery": 0,
  • "maxQueriesPerIPPerHour": 0,
  • "queryParameters": "typoTolerance=strict&restrictSources=192.168.1.0/24",
  • "referers": [
    ],
  • "validity": 86400
}

Update an API key

Replaces the permissions of an existing API key.

Any unspecified attribute resets that attribute to its default value.

acl: ["admin"]
path Parameters
key
required
string
Example: YourAPIKey

API key.

Request Body schema: application/json
required
acl
required
Array of strings
Default: []
Items Enum: "addObject" "analytics" "browse" "deleteIndex" "deleteObject" "editSettings" "inference" "listIndexes" "logs" "personalization" "recommendation" "search" "seeUnretrievableAttributes" "settings" "usage"

Permissions that determine the type of API requests this key can make. The required ACL is listed in each endpoint's reference. For more information, see access control list.

description
string
Default: ""

Description of an API key to help you identify this API key.

indexes
Array of strings
Default: []

Index names or patterns that this API key can access. By default, an API key can access all indices in the same application.

You can use leading and trailing wildcard characters (*):

  • dev_* matches all indices starting with "dev_".
  • *_dev matches all indices ending with "_dev".
  • *_products_* matches all indices containing "products".
maxHitsPerQuery
integer
Default: 0

Maximum number of results this API key can retrieve in one query. By default, there's no limit.

maxQueriesPerIPPerHour
integer
Default: 0

Maximum number of API requests allowed per IP address or user token per hour.

If this limit is reached, the API returns an error with status code 429. By default, there's no limit.

queryParameters
string
Default: ""

Query parameters to add when making API requests with this API key.

To restrict this API key to specific IP addresses, add the restrictSources parameter. You can only add a single source, but you can provide a range of IP addresses.

Creating an API key fails if the request is made from an IP address that's outside the restricted range.

referers
Array of strings
Default: []

Allowed HTTP referrers for this API key.

By default, all referrers are allowed. You can use leading and trailing wildcard characters (*):

  • https://algolia.com/* allows all referrers starting with "https://algolia.com/"
  • *.algolia.com allows all referrers ending with ".algolia.com"
  • *algolia.com* allows all referrers in the domain "algolia.com".

Like all HTTP headers, referrers can be spoofed. Don't rely on them to secure your data. For more information, see HTTP referrer restrictions.

validity
integer
Default: 0

Duration (in seconds) after which the API key expires. By default, API keys don't expire.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.UpdateApiKeyAsync(
  "myApiKey",
  new ApiKey
  {
    Acl = new List<Acl> { Enum.Parse<Acl>("Search"), Enum.Parse<Acl>("AddObject") },
    Validity = 300,
    MaxQueriesPerIPPerHour = 100,
    MaxHitsPerQuery = 20,
  }
);

Response samples

Content type
application/json
{
  • "key": "13ad45b4d0a2f6ea65ecbddf6aa260f2",
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Delete an API key

Deletes the API key.

acl: ["admin"]
path Parameters
key
required
string
Example: YourAPIKey

API key.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteApiKeyAsync("myTestApiKey");

Response samples

Content type
application/json
{
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Restore an API key

Restores a deleted API key.

Restoring resets the validity attribute to 0.

Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can't be restored.

acl: ["admin"]
path Parameters
key
required
string
Example: YourAPIKey

API key.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.RestoreApiKeyAsync("myApiKey");

Response samples

Content type
application/json
{
  • "key": "13ad45b4d0a2f6ea65ecbddf6aa260f2",
  • "createdAt": "2023-07-04T12:49:15Z"
}

Clusters

Multi-cluster operations.

Algolia no longer offers multi-cluster management.

Assign or move a user ID

Assigns or moves a user ID to a cluster.

The time it takes to move a user is proportional to the amount of data linked to the user ID.

acl: ["admin"]
header Parameters
X-Algolia-User-ID
required
string^[a-zA-Z0-9 \-*.]+$
Example: user1

Unique identifier of the user who makes the search request.

Request Body schema: application/json
required
cluster
required
string

Cluster name.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.AssignUserIdAsync(
  "userID",
  new AssignUserIdParams { Cluster = "theCluster", }
);

Response samples

Content type
application/json
{
  • "createdAt": "2023-07-04T12:49:15Z"
}

List user IDs

Lists the userIDs assigned to a multi-cluster application.

Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.

acl: ["admin"]
query Parameters
hitsPerPage
integer
Default: 100

Number of hits per page.

integer or null
Default: null

Requested page of the API response. If null, the API response is not paginated.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ListUserIdsAsync();

Response samples

Content type
application/json
{
  • "userIDs": [
    ]
}

Assign multiple userIDs

Assigns multiple user IDs to a cluster.

You can't move users with this operation.

acl: ["admin"]
header Parameters
X-Algolia-User-ID
required
string^[a-zA-Z0-9 \-*.]+$
Example: user1

Unique identifier of the user who makes the search request.

Request Body schema: application/json
required
cluster
required
string

Cluster name.

users
required
Array of strings

User IDs to assign.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.BatchAssignUserIdsAsync(
  "userID",
  new BatchAssignUserIdsParams
  {
    Cluster = "theCluster",
    Users = new List<string> { "user1", "user2" },
  }
);

Response samples

Content type
application/json
{
  • "createdAt": "2023-07-04T12:49:15Z"
}

Get top user IDs

Get the IDs of the 10 users with the highest number of records per cluster.

Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.

acl: ["admin"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetTopUserIdsAsync();

Response samples

Content type
application/json
{
  • "topUsers": [
    ]
}

Retrieve user ID

Returns the user ID data stored in the mapping.

Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.

acl: ["admin"]
path Parameters
userID
required
string^[a-zA-Z0-9 \-*.]+$
Example: user1

Unique identifier of the user who makes the search request.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetUserIdAsync("uniqueID");

Response samples

Content type
application/json
{
  • "userID": "user1",
  • "clusterName": "c1-test",
  • "nbRecords": 42,
  • "dataSize": 0
}

Delete user ID

Deletes a user ID and its associated data from the clusters.

acl: ["admin"]
path Parameters
userID
required
string^[a-zA-Z0-9 \-*.]+$
Example: user1

Unique identifier of the user who makes the search request.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.RemoveUserIdAsync("uniqueID");

Response samples

Content type
application/json
{
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

List clusters

Lists the available clusters in a multi-cluster setup.

acl: ["admin"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ListClustersAsync();

Response samples

Content type
application/json
{
  • "topUsers": [
    ]
}

Search for user IDs

Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.

To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).

acl: ["admin"]
Request Body schema: application/json
required
query
required
string

Query to search. The search is a prefix search with typo tolerance enabled. An empty query will retrieve all users.

clusterName
string

Cluster name.

hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Number of hits per page.

page
integer >= 0
Default: 0

Page of search results to retrieve.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.SearchUserIdsAsync(
  new SearchUserIdsParams
  {
    Query = "test",
    ClusterName = "theClusterName",
    Page = 5,
    HitsPerPage = 10,
  }
);

Response samples

Content type
application/json
{
  • "hits": [
    ],
  • "nbHits": 20,
  • "page": 0,
  • "hitsPerPage": 20,
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Get migration and user mapping status

To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.

acl: ["admin"]
query Parameters
getClusters
boolean

Whether to include the cluster's pending mapping state in the response.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.HasPendingMappingsAsync();

Response samples

Content type
application/json
{
  • "pending": true,
  • "clusters": {
    }
}

Vaults

Algolia Vault lets you restrict access to your clusters to specific IP addresses and provides disk-level encryption at rest.

List allowed sources

Retrieves all allowed IP addresses with access to your application.

acl: ["admin"]

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetSourcesAsync();

Response samples

Content type
application/json
[
  • {
    }
]

Replace allowed sources

Replaces the list of allowed sources.

acl: ["admin"]
Request Body schema: application/json
required

Allowed sources.

Array
source
required
string

IP address range of the source.

description
string

Source description.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.ReplaceSourcesAsync(
  new List<Source>
  {
    new Source { VarSource = "theSource", Description = "theDescription", }
  }
);

Response samples

Content type
application/json
{
  • "updatedAt": "2023-07-04T12:49:15Z"
}

Add a source

Adds a source to the list of allowed sources.

acl: ["admin"]
Request Body schema: application/json
required

Source to add.

source
required
string

IP address range of the source.

description
string

Source description.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.AppendSourceAsync(
  new Source { VarSource = "theSource", Description = "theDescription", }
);

Response samples

Content type
application/json
{
  • "createdAt": "2023-07-04T12:49:15Z"
}

Delete a source

Deletes a source from the list of allowed sources.

acl: ["admin"]
path Parameters
source
required
string
Example: 10.0.0.1/32

IP address range of the source.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.DeleteSourceAsync("theSource");

Response samples

Content type
application/json
{
  • "deletedAt": "2023-06-27T14:42:38.831Z"
}

Advanced

Query your logs.

Retrieve log entries

The request must be authenticated by an API key with the logs ACL.

  • Logs are held for the last seven days.
  • Up to 1,000 API requests per server are logged.
  • This request counts towards your operations quota but doesn't appear in the logs itself.
acl: ["logs"]
query Parameters
string or null
Example: indexName=products

Index for which to retrieve log entries. By default, log entries are retrieved for all indices.

length
integer <= 1000
Default: 10

Maximum number of entries to retrieve.

offset
integer
Default: 0

First log entry to retrieve. The most recent entries are listed first.

type
string
Default: "all"
Enum: "all" "build" "error" "query"

Type of log entries to retrieve. By default, all log entries are retrieved.

Responses

Request samples

// Initialize the client
var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY"));

// Call the API
var response = await client.GetLogsAsync();

Response samples

Content type
application/json
{
  • "logs": [
    ]
}

Index settings

advancedSyntax
boolean
Default: false

Whether to support phrase matching and excluding words from search queries.

Use the advancedSyntaxFeatures parameter to control which feature is supported.

advancedSyntaxFeatures
Array of strings
Default: ["exactPhrase","excludeWords"]
Items Enum: "exactPhrase" "excludeWords"

Advanced search syntax features you want to support.

  • exactPhrase. Phrases in quotes must match exactly. For example, sparkly blue "iPhone case" only returns records with the exact string "iPhone case".

  • excludeWords. Query words prefixed with a - must not occur in a record. For example, search -engine matches records that contain "search" but not "engine".

This setting only has an effect if advancedSyntax is true.

allowCompressionOfIntegerArray
boolean
Default: false

Whether arrays with exclusively non-negative integers should be compressed for better performance. If true, the compressed arrays may be reordered.

allowTyposOnNumericTokens
boolean
Default: true

Whether to allow typos on numbers in the search query.

Turn off this setting to reduce the number of irrelevant matches when searching in large sets of similar numbers.

alternativesAsExact
Array of strings
Default: ["ignorePlurals","singleWordSynonym"]
Items Enum: "ignorePlurals" "multiWordsSynonym" "singleWordSynonym"

Alternatives of query words that should be considered as exact matches by the Exact ranking criterion.

  • ignorePlurals. Plurals and similar declensions added by the ignorePlurals setting are considered exact matches.

  • singleWordSynonym. Single-word synonyms, such as "NY/NYC" are considered exact matches.

  • multiWordsSynonym. Multi-word synonyms, such as "NY/New York" are considered exact matches.

attributeCriteriaComputedByMinProximity
boolean
Default: false

Whether the best matching attribute should be determined by minimum proximity.

This setting only affects ranking if the Attribute ranking criterion comes before Proximity in the ranking setting. If true, the best matching attribute is selected based on the minimum proximity of multiple matches. Otherwise, the best matching attribute is determined by the order in the searchableAttributes setting.

attributeForDistinct
string

Attribute that should be used to establish groups of results. Attribute names are case-sensitive.

All records with the same value for this attribute are considered a group. You can combine attributeForDistinct with the distinct search parameter to control how many items per group are included in the search results.

If you want to use the same attribute also for faceting, use the afterDistinct modifier of the attributesForFaceting setting. This applies faceting after deduplication, which will result in accurate facet counts.

attributesForFaceting
Array of strings
Default: []

Attributes used for faceting.

Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive.

Modifiers

  • filterOnly("ATTRIBUTE"). Allows using this attribute as a filter, but doesn't evalue the facet values.

  • searchable("ATTRIBUTE"). Allows searching for facet values.

  • afterDistinct("ATTRIBUTE"). Evaluates the facet count after deduplication with distinct. This ensures accurate facet counts. You can apply this modifier to searchable facets: afterDistinct(searchable(ATTRIBUTE)).

attributesToHighlight
Array of strings

Attributes to highlight.

By default, all searchable attributes are highlighted. Use * to highlight all attributes or use an empty array [] to turn off highlighting. Attribute names are case-sensitive.

With highlighting, strings that match the search query are surrounded by HTML tags defined by highlightPreTag and highlightPostTag. You can use this to visually highlight matching parts of a search query in your UI.

For more information, see Highlighting and snippeting.

attributesToRetrieve
Array of strings
Default: ["*"]

Attributes to include in the API response.

To reduce the size of your response, you can retrieve only some of the attributes. Attribute names are case-sensitive.

  • * retrieves all attributes, except attributes included in the customRanking and unretrievableAttributes settings.
  • To retrieve all attributes except a specific one, prefix the attribute with a dash and combine it with the *: ["*", "-ATTRIBUTE"].
  • The objectID attribute is always included.
attributesToSnippet
Array of strings
Default: []

Attributes for which to enable snippets. Attribute names are case-sensitive.

Snippets provide additional context to matched words. If you enable snippets, they include 10 words, including the matched word. The matched word will also be wrapped by HTML tags for highlighting. You can adjust the number of words with the following notation: ATTRIBUTE:NUMBER, where NUMBER is the number of words to be extracted.

attributesToTransliterate
Array of strings

Attributes, for which you want to support Japanese transliteration.

Transliteration supports searching in any of the Japanese writing systems. To support transliteration, you must set the indexing language to Japanese. Attribute names are case-sensitive.

camelCaseAttributes
Array of strings
Default: []

Attributes for which to split camel case words. Attribute names are case-sensitive.

object

Characters and their normalized replacements. This overrides Algolia's default normalization.

customRanking
Array of strings
Default: []

Attributes to use as custom ranking. Attribute names are case-sensitive.

The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.

Records with missing values for your selected custom ranking attributes are always sorted last. Boolean attributes are sorted based on their alphabetical order.

Modifiers

  • asc("ATTRIBUTE"). Sort the index by the values of an attribute, in ascending order.

  • desc("ATTRIBUTE"). Sort the index by the values of an attribute, in descending order.

If you use two or more custom ranking attributes, reduce the precision of your first attributes, or the other attributes will never be applied.

decompoundedAttributes
object
Default: {}

Searchable attributes to which Algolia should apply word segmentation (decompounding). Attribute names are case-sensitive.

Compound words are formed by combining two or more individual words, and are particularly prevalent in Germanic languages—for example, "firefighter". With decompounding, the individual components are indexed separately.

You can specify different lists for different languages. Decompounding is supported for these languages: Dutch (nl), German (de), Finnish (fi), Danish (da), Swedish (sv), and Norwegian (no).

decompoundQuery
boolean
Default: true

Whether to split compound words into their building blocks.

For more information, see Word segmentation. Word segmentation is supported for these languages: German, Dutch, Finnish, Swedish, and Norwegian.

disableExactOnAttributes
Array of strings
Default: []

Searchable attributes for which you want to turn off the Exact ranking criterion. Attribute names are case-sensitive.

This can be useful for attributes with long values, where the likelyhood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.

disablePrefixOnAttributes
Array of strings
Default: []

Searchable attributes for which you want to turn off prefix matching. Attribute names are case-sensitive.

disableTypoToleranceOnAttributes
Array of strings
Default: []

Attributes for which you want to turn off typo tolerance. Attribute names are case-sensitive.

Returning only exact matches can help when:

  • Searching in hyphenated attributes.
  • Reducing the number of matches when you have too many. This can happen with attributes that are long blocks of text, such as product descriptions.

Consider alternatives such as disableTypoToleranceOnWords or adding synonyms if your attributes have intentional unusual spellings that might look like typos.

disableTypoToleranceOnWords
Array of strings
Default: []

Words for which you want to turn off typo tolerance. This also turns off word splitting and concatenation for the specified words.

boolean or integer

Determines how many records of a group are included in the search results.

Records with the same value for the attributeForDistinct attribute are considered a group. The distinct setting controls how many members of the group are returned. This is useful for deduplication and grouping.

The distinct setting is ignored if attributeForDistinct is not set.

enablePersonalization
boolean
Default: false

Whether to enable Personalization.

enableReRanking
boolean
Default: true

Whether this search will use Dynamic Re-Ranking.

This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.

enableRules
boolean
Default: true

Whether to enable rules.

exactOnSingleWordQuery
string
Default: "attribute"
Enum: "attribute" "none" "word"

Determines how the Exact ranking criterion is computed when the search query has only one word.

  • attribute. The Exact ranking criterion is 1 if the query word and attribute value are the same. For example, a search for "road" will match the value "road", but not "road trip".

  • none. The Exact ranking criterion is ignored on single-word searches.

  • word. The Exact ranking criterion is 1 if the query word is found in the attribute value. The query word must have at least 3 characters and must not be a stop word. Only exact matches will be highlighted, partial and prefix matches won't.

highlightPostTag
string
Default: "</em>"

HTML tag to insert after the highlighted parts in all highlighted results and snippets.

highlightPreTag
string
Default: "<em>"

HTML tag to insert before the highlighted parts in all highlighted results and snippets.

hitsPerPage
integer [ 1 .. 1000 ]
Default: 20

Number of hits per page.

Array of supportedLanguage (strings) or boolean

Treat singular, plurals, and other forms of declensions as equivalent. You should only use this feature for the languages used in your index.

indexLanguages
Array of strings
Default: []
Items Enum: "af" "ar" "az" "bg" "bn" "ca" "cs" "cy" "da" "de" "el" "en" "eo" "es" "et" "eu" "fa" "fi" "fo" "fr" "ga" "gl" "he" "hi" "hu" "hy" "id" "is" "it" "ja" "ka" "kk" "ko" "ku" "ky" "lt" "lv" "mi" "mn" "mr" "ms" "mt" "nb" "nl" "no" "ns" "pl" "ps" "pt" "pt-br" "qu" "ro" "ru" "sk" "sq" "sv" "sw" "ta" "te" "th" "tl" "tn" "tr" "tt" "uk" "ur" "uz" "zh"

Languages for language-specific processing steps, such as word detection and dictionary settings.

You should always specify an indexing language. If you don't specify an indexing language, the search engine uses all supported languages, or the languages you specified with the ignorePlurals or removeStopWords parameters. This can lead to unexpected search results. For more information, see Language-specific configuration.

keepDiacriticsOnCharacters
string
Default: ""

Characters for which diacritics should be preserved.

By default, Algolia removes diacritics from letters. For example, é becomes e. If this causes issues in your search, you can specify characters that should keep their diacritics.

maxFacetHits
integer <= 100
Default: 10

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

maxValuesPerFacet
integer <= 1000
Default: 100

Maximum number of facet values to return for each facet.

minProximity
integer [ 1 .. 7 ]
Default: 1

Minimum proximity score for two matching words.

This adjusts the Proximity ranking criterion by equally scoring matches that are farther apart.

For example, if minProximity is 2, neighboring matches and matches with one word between them would have the same score.

minWordSizefor1Typo
integer
Default: 4

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

minWordSizefor2Typos
integer
Default: 8

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

mode
string
Default: "keywordSearch"
Enum: "keywordSearch" "neuralSearch"

Search mode the index will use to query for results.

This setting only applies to indices, for which Algolia enabled NeuralSearch for you.

numericAttributesForFiltering
Array of strings
Default: []

Numeric attributes that can be used as numerical filters. Attribute names are case-sensitive.

By default, all numeric attributes are available as numerical filters. For faster indexing, reduce the number of numeric attributes.

If you want to turn off filtering for all numeric attributes, specifiy an attribute that doesn't exist in your index, such as NO_NUMERIC_FILTERING.

Modifier

  • equalOnly("ATTRIBUTE"). Support only filtering based on equality comparisons = and !=.
optionalWords
Array of strings
Default: []

Words that should be considered optional when found in the query.

By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is "action video" and "video" is an optional word, the search engine runs two queries. One for "action video" and one for "action". Records that match all words are ranked higher.

For a search query with 4 or more words and all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records:

  • If optionalWords has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words.
  • If optionalWords has 10 or more words, the number of required matched words increases by the number of optional words dividied by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words.

For more information, see Optional words.

paginationLimitedTo
integer <= 20000
Default: 1000

Maximum number of search results that can be obtained through pagination.

Higher pagination limits might slow down your search. For pagination limits above 1,000, the sorting of results beyond the 1,000th hit can't be guaranteed.

queryLanguages
Array of strings
Default: []
Items Enum: "af" "ar" "az" "bg" "bn" "ca" "cs" "cy" "da" "de" "el" "en" "eo" "es" "et" "eu" "fa" "fi" "fo" "fr" "ga" "gl" "he" "hi" "hu" "hy" "id" "is" "it" "ja" "ka" "kk" "ko" "ku" "ky" "lt" "lv" "mi" "mn" "mr" "ms" "mt" "nb" "nl" "no" "ns" "pl" "ps" "pt" "pt-br" "qu" "ro" "ru" "sk" "sq" "sv" "sw" "ta" "te" "th" "tl" "tn" "tr" "tt" "uk" "ur" "uz" "zh"

Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries.

This setting sets a default list of languages used by the removeStopWords and ignorePlurals settings. This setting also sets a dictionary for word detection in the logogram-based CJK languages. To support this, you must place the CJK language first.

You should always specify a query language. If you don't specify an indexing language, the search engine uses all supported languages, or the languages you specified with the ignorePlurals or removeStopWords parameters. This can lead to unexpected search results. For more information, see Language-specific configuration.

queryType
string
Default: "prefixLast"
Enum: "prefixAll" "prefixLast" "prefixNone"

Determines if and how query words are interpreted as prefixes.

By default, only the last query word is treated as prefix (prefixLast). To turn off prefix search, use prefixNone. Avoid prefixAll, which treats all query words as prefixes. This might lead to counterintuitive results and makes your search slower.

For more information, see Prefix searching.

ranking
Array of strings
Default: ["typo","geo","words","filters","proximity","attribute","exact","custom"]

Determines the order in which Algolia returns your results.

By default, each entry corresponds to a ranking criteria. The tie-breaking algorithm sequentially applies each criterion in the order they're specified. If you configure a replica index for sorting by an attribute, you put the sorting attribute at the top of the list.

Modifiers

  • asc("ATTRIBUTE"). Sort the index by the values of an attribute, in ascending order.
  • desc("ATTRIBUTE"). Sort the index by the values of an attribute, in descending order.

Before you modify the default setting, you should test your changes in the dashboard, and by A/B testing.

relevancyStrictness
integer
Default: 100

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

You can only set relevancyStrictness on virtual replica indices. Use this setting to strike a balance between the relevance and number of returned results.

Array of supportedLanguage (strings) or boolean

Removes stop words from the search query.

Stop words are common words like articles, conjunctions, prepositions, or pronouns that have little or no meaning on their own. In English, "the", "a", or "and" are stop words.

You should only use this feature for the languages used in your index.

removeWordsIfNoResults
string
Default: "none"
Enum: "allOptional" "firstWords" "lastWords" "none"

Strategy for removing words from the query when it doesn't return any results. This helps to avoid returning empty search results.

  • none. No words are removed when a query doesn't return results.

  • lastWords. Treat the last (then second to last, then third to last) word as optional, until there are results or at most 5 words have been removed.

  • firstWords. Treat the first (then second, then third) word as optional, until there are results or at most 5 words have been removed.

  • allOptional. Treat all words as optional.

For more information, see Remove words to improve results.

object

Extra data that can be used in the search UI.

You can use this to control aspects of your search UI, such as, the order of facet names and values without changing your frontend code.

replaceSynonymsInHighlight
boolean
Default: false

Whether to replace a highlighted word with the matched synonym.

By default, the original words are highlighted even if a synonym matches. For example, with home as a synonym for house and a search for home, records matching either "home" or "house" are included in the search results, and either "home" or "house" are highlighted.

With replaceSynonymsInHighlight set to true, a search for home still matches the same records, but all occurences of "house" are replaced by "home" in the highlighted response.

replicas
Array of strings
Default: []

Creates replica indices.

Replicas are copies of a primary index with the same records but different settings, synonyms, or rules. If you want to offer a different ranking or sorting of your search results, you'll use replica indices. All index operations on a primary index are automatically forwarded to its replicas. To add a replica index, you must provide the complete set of replicas to this parameter. If you omit a replica from this list, the replica turns into a regular, standalone index that will no longer by synced with the primary index.

Modifier

  • virtual("REPLICA"). Create a virtual replica, Virtual replicas don't increase the number of records and are optimized for Relevant sorting.
(Array of search filters (Array of search filter array (strings) or strings)) or string or null

Restrict Dynamic Re-Ranking to records that match these filters.

responseFields
Array of strings
Default: ["*"]

Properties to include in the API response of search and browse requests.

By default, all response properties are included. To reduce the response size, you can select, which attributes should be included.

You can't exclude these properties: message, warning, cursor, serverUsed, indexUsed, abTestVariantID, parsedQuery, or any property triggered by the getRankingInfo parameter.

Don't exclude properties that you might need in your search UI.

restrictHighlightAndSnippetArrays
boolean
Default: false

Whether to restrict highlighting and snippeting to items that at least partially matched the search query. By default, all items are highlighted and snippeted.

searchableAttributes
Array of strings
Default: []

Attributes used for searching. Attribute names are case-sensitive.

By default, all attributes are searchable and the Attribute ranking criterion is turned off. With a non-empty list, Algolia only returns results with matches in the selected attributes. In addition, the Attribute ranking criterion is turned on: matches in attributes that are higher in the list of searchableAttributes rank first. To make matches in two attributes rank equally, include them in a comma-separated string, such as "title,alternate_title". Attributes with the same priority are always unordered.

For more information, see Searchable attributes.

Modifier

  • unordered("ATTRIBUTE"). Ignore the position of a match within the attribute.

Without modifier, matches at the beginning of an attribute rank higer than matches at the end.

object

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

separatorsToIndex
string
Default: ""

Controls which separators are indexed.

Separators are all non-letter characters except spaces and currency characters, such as $€£¥. By default, separator characters aren't indexed. With separatorsToIndex, Algolia treats separator characters as separate words. For example, a search for C# would report two matches.

snippetEllipsisText
string
Default: "…"

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

sortFacetValuesBy
string
Default: "count"

Order in which to retrieve facet values.

  • count. Facet values are retrieved by decreasing count. The count is the number of matching records containing this facet value.

  • alpha. Retrieve facet values alphabetically.

This setting doesn't influence how facet values are displayed in your UI (see renderingContent). For more information, see facet value display.

boolean or typo tolerance (string)

Whether typo tolerance is enabled and how it is applied.

If typo tolerance is true, min, or strict, word splitting and concetenation is also active.

unretrievableAttributes
Array of strings
Default: []

Attributes that can't be retrieved at query time.

This can be useful if you want to use an attribute for ranking or to restrict access, but don't want to include it in the search results. Attribute names are case-sensitive.

userData
any
Default: {}

An object with custom data.

You can store up to 32 kB as custom data.

{
  • "attributesForFaceting": [
    ],
  • "replicas": [
    ],
  • "paginationLimitedTo": 100,
  • "unretrievableAttributes": [
    ],
  • "disableTypoToleranceOnWords": [
    ],
  • "attributesToTransliterate": [
    ],
  • "camelCaseAttributes": [
    ],
  • "decompoundedAttributes": {
    },
  • "indexLanguages": [
    ],
  • "disablePrefixOnAttributes": [
    ],
  • "allowCompressionOfIntegerArray": false,
  • "numericAttributesForFiltering": [
    ],
  • "separatorsToIndex": "+#",
  • "searchableAttributes": [
    ],
  • "userData": {
    },
  • "customNormalization": {
    },
  • "attributeForDistinct": "url",
  • "attributesToRetrieve": [
    ],
  • "ranking": [
    ],
  • "customRanking": [
    ],
  • "relevancyStrictness": 90,
  • "attributesToHighlight": [
    ],
  • "attributesToSnippet": [
    ],
  • "highlightPreTag": "<em>",
  • "highlightPostTag": "</em>",
  • "snippetEllipsisText": "…",
  • "restrictHighlightAndSnippetArrays": false,
  • "hitsPerPage": 20,
  • "minWordSizefor1Typo": 4,
  • "minWordSizefor2Typos": 8,
  • "typoTolerance": true,
  • "allowTyposOnNumericTokens": true,
  • "disableTypoToleranceOnAttributes": [
    ],
  • "ignorePlurals": [
    ],
  • "removeStopWords": [
    ],
  • "keepDiacriticsOnCharacters": "øé",
  • "queryLanguages": [
    ],
  • "decompoundQuery": true,
  • "enableRules": true,
  • "enablePersonalization": false,
  • "queryType": "prefixAll",
  • "removeWordsIfNoResults": "firstWords",
  • "mode": "keywordSearch",
  • "semanticSearch": {
    },
  • "advancedSyntax": false,
  • "optionalWords": [
    ],
  • "disableExactOnAttributes": [
    ],
  • "exactOnSingleWordQuery": "attribute",
  • "alternativesAsExact": [
    ],
  • "advancedSyntaxFeatures": [
    ],
  • "distinct": 1,
  • "replaceSynonymsInHighlight": false,
  • "minProximity": 1,
  • "responseFields": [
    ],
  • "maxFacetHits": 10,
  • "maxValuesPerFacet": 100,
  • "sortFacetValuesBy": "count",
  • "attributeCriteriaComputedByMinProximity": false,
  • "renderingContent": {
    },
  • "enableReRanking": true,
  • "reRankingApplyFilter": [
    ]
}

.