Oct 21, 2024
Upgrade the Ruby API clients to v3
The latest major version of the algolia gem 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
Recommend API client
Client imports
The class names for the API clients changed.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Search API
Algolia::SearchClient
# Recommend API
Algolia::RecommendClient
# A/B testing
Algolia::AbtestingClient
# Analytics API
Algolia::AnalyticsClient
# Ingestion API
Algolia::IngestionClient
# Insights API
Algolia::InsightsClient
# Monitoring API
Algolia::MonitoringClient
# Personalization API
Algolia::PersonalizationClient
# Query Suggestions API
Algolia::QuerySuggestionsClient
# Usage API
Algolia::UsageClient
Removal of init_index
All methods are methods of a client instance.
The init_index method of the SearchClient has been removed.
Instead, all methods require a index_name parameter.
Copy
1
2
3
4
5
6
7
8
# v2
client = Algolia::Search::Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
index = client.init_index("ALGOLIA_INDEX_NAME")
index.search("QUERY")
# v3
client = Algolia::Search::Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
client.search_single_index("ALGOLIA_INDEX_NAME", {query: "QUERY"})
Wait for tasks
The wait method has been removed.
Instead, use one of the following helpers:
wait_for_taskto wait until indexing operations are donewait_for_app_taskto wait for application-level taskswait_for_api_keyto wait for API key operations
Copy or move indices, settings, synonyms, or rules
Use the operation_index method,
which replaces the following methods:
copy_indexmove_indexcopy_rulescopy_synonymscopy_settings
Did you find this page helpful?