| name | algolia-upgrade-migration |
| description | Upgrade algoliasearch from v4 to v5 with breaking change detection and codemod.
Use when upgrading SDK versions, detecting deprecations, or migrating initIndex patterns.
Trigger: "upgrade algolia", "algolia migration v5", "algolia breaking changes",
"update algolia SDK", "algolia v4 to v5".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(git:*), Bash(npx:*), Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","search","algolia"] |
| compatibility | Designed for Claude Code |
Algolia Upgrade & Migration (v4 to v5)
Overview
Guide for upgrading algoliasearch from v4 to v5. The v5 release is a major rewrite: initIndex() is removed, all methods move to the client, and the import style changes.
Prerequisites
- Current
algoliasearch v4 installed
- Git for version control (work in a branch)
- Test suite passing on current version
Breaking Changes Summary
| v4 Pattern | v5 Replacement |
|---|
const client = algoliasearch(appId, key) | import { algoliasearch } from 'algoliasearch'; const client = algoliasearch(appId, key); |
const index = client.initIndex('name') | Removed — pass indexName to every method |
index.search('query') | client.searchSingleIndex({ indexName, searchParams: { query } }) |
index.saveObjects(records) | client.saveObjects({ indexName, objects }) |
index.saveObject(record) | client.saveObject({ indexName, body: record }) |
index.partialUpdateObject(data) | client.partialUpdateObject({ indexName, objectID, attributesToUpdate }) |
index.deleteObject('id') | client.deleteObject({ indexName, objectID }) |
index.setSettings(settings) | client.setSettings({ indexName, indexSettings }) |
index.getSettings() | client.getSettings({ indexName }) |
index.browse() | client.browse({ indexName, browseParams }) |
index.findObject(cb) | client.findObject({ indexName, ... }) |
index.replaceAllObjects(records) | client.replaceAllObjects({ indexName, objects }) |