Terminal
Terminal/Skill
Migrates Algolia API client code to a newer major version in JavaScript, Python, Go, PHP, Java, C#, Ruby, Kotlin, Scala, or Swift.
By Algolia
Works with
npx skills add algolia/skills --skill algolia-migrationThis skill covers API client upgrades (backend and frontend search-only builds). For frontend search UI, see instantsearch. For index operations, see algolia-cli.
| Language | Migration | Reference |
|---|---|---|
| JavaScript | v4 → v5 | references/javascript.md |
| Python | v3 → v4 | references/python.md |
| Go | v3 → v4 | references/go.md |
| PHP | v3 → v4 | references/php.md |
| Java | v3 → v4 | references/java.md |
| C# | v6 → v7 | references/csharp.md |
| Ruby | v2 → v3 | references/ruby.md |
| Kotlin | v2 → v3 | references/kotlin.md |
| Scala | v1 → v2 | references/scala.md |
| Swift | v8 → v9 | references/swift.md |
Open the matching reference file before writing any migration code.
Every language migration shares the same set of architectural shifts. Understand these first; the reference files add language-specific syntax on top.
initIndex is goneThe index object pattern is eliminated in every language. All methods moved to the client with indexName as an explicit parameter.
The fix: remove initIndex / init_index / index(withName:), call the method on the client, pass indexName.
Grep to find all affected call sites:
grep -r "initIndex\|init_index\|InitIndex\|index(withName" .
.wait() chaining is goneChained .wait() / ! bang methods on task responses are replaced by dedicated wait helpers.
| Old | New |
|---|---|
index.saveObjects(records).wait() | client.waitForTask(...) with the index name and task ID |
index.save_objects!(objects) (Ruby) | client.save_objects(index_name, objects, true) |
Three helpers available in every language: waitForTask, waitForAppTask, waitForApiKey. The exact calling convention varies by language (e.g. JS v5 takes an options object, Python uses keyword arguments) — see the language reference for the precise signature.
copyIndex / moveIndex → operationIndexAll index copy and move operations, including scoped copies (copyRules, copySettings, copySynonyms), consolidate into a single operationIndex call with operation: "copy" or "move" and an optional scope array.
objectID is required in saveObjectsautoGenerateObjectIDIfNotExist is removed. Every object passed to saveObjects must include an explicit objectID. To let the API generate IDs, use chunkedBatch with action: addObject.
replaceAllObjects — scopes is optionalThe safe option is removed. The scopes parameter defaults to ["settings", "rules", "synonyms"] in every language — you only need to pass it explicitly if you want a subset.
The old iterator/chained patterns are gone. The new pattern varies by language — check the reference file:
aggregator function that receives each page responseIEnumerable<T> / Iterable<T> — iterate with foreach or .forEach()ObjectIterator — iterate with a for-each loopAccountClient is goneCross-application index copies now require composing helpers across two client instances manually: get settings from source, set on destination; browse + save for rules, synonyms, and objects.
JavaScript exception: v5 ships client.accountCopyIndex({ sourceIndexName, destinationAppID, destinationApiKey, destinationIndexName, ... }) as a built-in. No manual composition needed, but the call signature differs from v4's accountCopyIndex(srcIndex, destIndex) — see references/javascript.md.
Each API now has its own client class. If the code previously imported one monolithic client, update imports for RecommendClient, AnalyticsClient, AbtestingClient, etc.
package.json, go.mod, composer.json, pom.xml, Gemfile, etc.).initIndex (and language equivalents) to enumerate all call sites..wait(), waitTask, wait_task, bang methods.If the skill doesn't trigger automatically, invoke it directly:
/algolia-migration — Load the full skill for any Algolia client upgrade taskThis is useful when the request is brief (e.g., "update my Algolia imports") and the skill might not auto-trigger.