You're viewing an archived version of our docs. Check out our current documentation →

Upgrade the Kotlin API clients to v3

The latest major version of the algoliasearch-client-kotlin package is v3. This page lists the breaking changes since the last release, v2.

Method changes overview

The following table has links for all methods and their replacements

Search API client

v2 (legacy) v3 (latest)
client.addAPIKey → client.addApiKey
client.addAPIKey.wait → client.waitForApiKey
client.assignUserID → client.assignUserId
not available → client.batchAssignUserIds
client.clearDictionaryEntries → client.batchDictionaryEntries
client.copyIndex → client.operationIndex
client.copyRules → client.operationIndex
client.copySynonyms → client.operationIndex
client.deleteAPIKey → client.deleteApiKey
client.deleteDictionaryEntries → client.batchDictionaryEntries
client.generateAPIKey → client.generateSecuredApiKey
client.getAPIKey → client.getApiKey
client.getSecuredAPIKeyRemainingValidity → client.getSecuredApiKeyRemainingValidity
client.getTopUserID → client.getTopUserIds
client.getUserID → client.getUserId
client.listAPIKeys → client.listApiKeys
client.listIndices → client.listIndices
client.listUserIDs → client.listUserIds
client.moveIndex → client.operationIndex
client.multipleBatchObjects → client.multipleBatch
client.multipleQueries → client.search
client.removeUserID → client.removeUserId
client.replaceDictionaryEntries → client.batchDictionaryEntries
client.restoreAPIKey → client.restoreApiKey
client.saveDictionaryEntries → client.batchDictionaryEntries
client.searchUserID → client.searchUserIds
client.updateAPIKey → client.updateApiKey
index.batch → client.batch
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.searchForFacets → client.searchForFacetValues
index.searchRules → client.searchRules
index.searchSynonyms → client.searchSynonyms
index.setSettings → client.setSettings
index.{operation}.wait → client.waitForTask

Recommend API client

v2 (legacy) v3 (latest)
client.getFrequentlyBoughtTogether → client.getRecommendations
client.getRecommendations → client.getRecommendations
client.getRelatedProducts → client.getRecommendations

Removal of initIndex

All methods are methods of a client instance. The initIndex method of the SearchClient class has been removed. Instead, all methods require a indexName parameter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// v2
val client = ClientSearch(
    ApplicationID("ALGOLIA_APPLICATION_ID"),
    APIKey("ALGOLIA_API_KEY")
)
val index = client.initIndex(
    IndexName("ALGOLIA_INDEX_NAME")
)
index.search(Query("QUERY"))

// v3
val client = SearchClient(
    "ALGOLIA_APPLICATION_ID",
    "ALGOLIA_API_KEY"
)
client.searchSingleIndex(
    "ALGOLIA_INDEX_NAME",
    SearchParamsObject(query = "QUERY")
)

No domain-specific language

The domain-specific language for setting parameters and filters from the v2 API client has been removed.

Wait for tasks

The wait method has been removed. Instead, use one of the following helpers:

Copy or moving indices, settings, synonyms, or rules

Use the operationIndex method, which replaces the following methods:

  • copyIndex
  • moveIndex
  • copyRules
  • copySynonyms
  • copySettings
Kotlin API clients v3