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.

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
Did you find this page helpful?
Kotlin API clients v3