Important note: in Algolia's context, file size and index size are interchangeable. The index size represents the space used in RAM, whereas data size is the raw JSON data stored on disk and used as a backup for e.g. doing a full reindex.
This package is a simple script that helps you compute the index size (per cluster and total for an app) when using Algolia's MCM architecture.
Regular install through npm or yarn:
npm i algolia-mcm-filesize
# or
yarn add algolia-mcm-filesize
It has been designed for manual use in a shell or to pipe it to another system, so it returns JSON instead of a pure JS object. Here is a quick usage suggestion:
const mcmFileSize = require('algolia-mcm-filesize')
mcmFileSize('APPID', 'ADMIN_APIKEY').then(res => console.log(res))
Optionally, you can pass a custom domain (default is algolia.net
)
const mcmFileSize = require('algolia-mcm-filesize')
mcmFileSize('APPID', 'ADMIN_APIKEY', 'algolianet.com').then(res => console.log(res))
Using jq for the sake of the example
node index.js | jq .
Sample output (cluster names are usually prefixed with d
or v
)
{
"cluster-1": 91,
"cluster-2": 83,
"cluster-3": 95,
"total": 269
}
Values are expressed in gigabyte (GB, not GiB)
Standard limit is 100 GB per cluster
The only dependency is the JS API client (v4)
You need to use the Admin API key (required for all MCM endpoints)
Under the hood, the package uses the following endpoints:
This package is not officially supported by Algolia, so it cannot be held responsible for any use in production. If you need support, use GitHub issues or the community forum, but not Algolia email support.