Algolia.Search package is version 7.
This page helps you upgrade from version 6
and explains the breaking changes you need to address.
Algolia generates the version 7 clients from OpenAPI specifications,
which provides consistent behavior across all languages and up-to-date API coverage.
The main architectural change is the removal of the InitIndex pattern:
all methods are now on the client instance directly, with indexName as a parameter.
For the full list of changes, see the C# changelog.
Update your dependencies
Update theAlgolia.Search package to version 7:
Version 7 replaces the
Newtonsoft.Json dependency with System.Text.Json.
If your project relies on Newtonsoft-specific attributes or converters,
see Update the serialization library for migration guidance.Update imports
The package name remainsAlgolia.Search,
but several model types have been renamed.
For example, the Query class no longer exists.
It’s replaced by SearchParams and SearchParamsObject.
C#
SearchClient class stays in the same namespace.
As you update your code, your IDE will flag missing types and suggest the correct using directives
for the new model classes.
Update client initialization
Client creation is unchanged. The constructor still accepts your application ID and API key:C#
InitIndex no longer exists.
Synchronous and asynchronous methods
Version 7 includes both synchronous and asynchronous variants for every API method. Asynchronous methods have anAsync suffix and return a Task<T>.
Synchronous methods keep the base name.
C#
Async suffix and the await keyword.
Remove InitIndex
This is the most significant change when upgrading.
Version 6 relied on an index object with methods called on it.
In version 7, all methods belong to the client instance,
with indexName as a parameter.
C#
Update search calls
Search a single index
Theindex.Search() method is now client.SearchSingleIndexAsync().
Pass the index name and search parameters directly:
C#
Search multiple indices
Theclient.MultipleQueries() method is now client.SearchAsync().
Each request in the collection requires an IndexName:
C#
Search for facet values
Theindex.SearchForFacetValues() method becomes client.SearchForFacetValuesAsync()
with an indexName parameter:
C#
Update indexing operations
In version 7, indexing methods are on the client instead of the index object, withindexName as a parameter.
Add or replace records
C#
Partially update records
C#
Delete records
C#
Update settings, synonyms, and rules
Get and set settings
C#
Save synonyms and rules
C#
In version 6,
index.ReplaceAllRules() and index.ReplaceAllSynonyms() replaced all rules or synonyms.
In version 7, use client.SaveRulesAsync() or client.SaveSynonymsAsync() with the clearExistingRules or clearExistingSynonyms parameter set to true.Update index management
TheCopyIndex, MoveIndex, CopyRules, CopySynonyms, and CopySettings
methods are all replaced by OperationIndexAsync.
Copy an index
C#
Move (rename) an index
C#
Copy only rules or settings
In version 7, use theScope parameter to limit the operation to specific data:
C#
Update task handling
Version 6 supported chaining.Wait() on operations.
Version 7 replaces this pattern with dedicated wait helpers.
C#
WaitForTask: wait until indexing operations are done.WaitForAppTask: wait for application-level tasks.WaitForApiKey: wait for API key operations.
Update the serialization library
TheAlgolia.Search package no longer depends on Newtonsoft.Json for request serialization and response deserialization.
Version 7 uses .NET’s official System.Text.Json package instead.
This is a significant change if your project relies on Newtonsoft.Json attributes
(such as [JsonProperty]) for custom serialization of your Algolia records.
If you were using the Newtonsoft.Json package for custom serialization,
see Migrate from Newtonsoft.Json to System.Text.Json
in Microsoft’s documentation.
Update enumeration serialization
To keep the serialization of enumeration types consistent with previous versions of the .NET API client, they’re serialized asint by default.
To serialize enumeration types as strings, use the JsonStringEnumConverter attribute from System.Text.Json.Serialization:
C#
MyProperty serializes as the string "MyValue2" instead of the integer 1.
Method changes reference
The following tables list all method names that changed between version 6 and version 7.Search API client
| Version 6 (legacy) | Version 7 (current) | |
|---|---|---|
client.AddApiKey | → | client.AddApiKey |
client.AddApiKey.Wait | → | client.WaitForApiKey |
DictionaryClient.ClearDictionaryEntries | → | client.BatchDictionaryEntries |
client.CopyIndex | → | client.OperationIndex |
client.CopyRules | → | client.OperationIndex |
client.CopySynonyms | → | client.OperationIndex |
client.DeleteApiKey | → | client.DeleteApiKey |
DictionaryClient.DeleteDictionaryEntries | → | client.BatchDictionaryEntries |
client.GenerateSecuredApiKey | → | client.GenerateSecuredApiKey |
client.GetApiKey | → | client.GetApiKey |
client.GetSecuredApiKeyRemainingValidity | → | client.GetSecuredApiKeyRemainingValidity |
client.ListApiKeys | → | client.ListApiKeys |
client.ListIndices | → | client.ListIndices |
client.MoveIndex | → | client.OperationIndex |
client.MultipleBatch | → | client.MultipleBatch |
client.MultipleQueries | → | client.Search |
DictionaryClient.ReplaceDictionaryEntries | → | client.BatchDictionaryEntries |
client.RestoreApiKey | → | client.RestoreApiKey |
DictionaryClient.SaveDictionaryEntries | → | client.BatchDictionaryEntries |
client.UpdateApiKey | → | client.UpdateApiKey |
index.Batch | → | client.Batch |
index.Browse | → | client.BrowseObjects |
index.BrowseRules | → | client.BrowseRules |
index.BrowseSynonyms | → | client.BrowseSynonyms |
index.ClearObjects | → | client.ClearObjects |
index.ClearRules | → | client.ClearRules |
index.ClearSynonyms | → | client.ClearSynonyms |
index.CopySettings | → | client.OperationIndex |
index.Delete | → | client.DeleteIndex |
index.DeleteBy | → | client.DeleteBy |
index.DeleteObject | → | client.DeleteObject |
index.DeleteObjects | → | client.DeleteObjects |
index.DeleteRule | → | client.DeleteRule |
index.DeleteSynonym | → | client.DeleteSynonym |
index.FindObject | → | client.SearchSingleIndex |
index.GetObject | → | client.GetObject |
index.GetObjects | → | client.GetObjects |
index.GetRule | → | client.GetRule |
index.GetSettings | → | client.GetSettings |
index.GetSynonym | → | client.GetSynonym |
index.GetTask | → | client.GetTask |
index.PartialUpdateObject | → | client.PartialUpdateObject |
index.PartialUpdateObjects | → | client.PartialUpdateObjects |
index.ReplaceAllObjects | → | client.ReplaceAllObjects |
index.ReplaceAllRules | → | client.SaveRules |
index.ReplaceAllSynonyms | → | client.SaveSynonyms |
index.SaveObject | → | client.SaveObject |
index.SaveObjects | → | client.SaveObjects |
index.SaveRule | → | client.SaveRule |
index.SaveRules | → | client.SaveRules |
index.SaveSynonym | → | client.SaveSynonym |
index.SaveSynonyms | → | client.SaveSynonyms |
index.Search | → | client.SearchSingleIndex |
index.SearchForFacetValues | → | client.SearchForFacetValues |
index.SearchRules | → | client.SearchRules |
index.SearchSynonyms | → | client.SearchSynonyms |
index.SetSettings | → | client.SetSettings |
index.{operation}.Wait | → | client.WaitForTask |
Recommend API client
| Version 6 (legacy) | Version 7 (current) | |
|---|---|---|
client.GetFrequentlyBoughtTogether | → | client.GetRecommendations |
client.GetRecommendations | → | client.GetRecommendations |
client.GetRelatedProducts | → | client.GetRecommendations |