Skip to content

Add index size fields and formatting to stats - #712

Open
floze-the-genius wants to merge 1 commit into
meilisearch:mainfrom
floze-the-genius:add/index-stats-sizes
Open

floze-the-genius wants to merge 1 commit into
meilisearch:mainfrom
floze-the-genius:add/index-stats-sizes

Conversation

@floze-the-genius

@floze-the-genius floze-the-genius commented Aug 14, 2026 •

Copy link
Copy Markdown

Summary

  • expose size_format on client and index stats calls and forward it as sizeFormat
  • cover the new indexSize and usedIndexSize fields for both stats endpoints
  • verify raw sizes are integers and human-formatted sizes are strings

Closes #711

Testing

  • bundle exec rubocop lib/meilisearch/client.rb lib/meilisearch/index.rb spec/meilisearch/client/stats_spec.rb spec/meilisearch/index/stats_spec.rb
  • targeted stats specs against Meilisearch v1.53.0: 9 examples, 0 failures
  • full suite against v1.53.0: 459 of 462 examples passed; the three failures were unrelated 5-second timeouts in existing embedder settings specs

AI assistance

Used Codex to implement the stats query forwarding and regression tests.

Summary by CodeRabbit

  • New Features
    • Statistics requests now support an optional size format.
    • Choose numeric values by default or human-readable sizes using the size_format option.
    • The option is available for both overall and index-specific statistics. This makes storage metrics easier to read while preserving the existing numeric format for applications that rely on it.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 21bf3b52-111f-4d3f-95e7-54093e2f20b2

📥 Commits

Reviewing files that changed from the base of the PR and between 857afce and 3c08a98.

📒 Files selected for processing (4)
  • lib/meilisearch/client.rb
  • lib/meilisearch/index.rb
  • spec/meilisearch/client/stats_spec.rb
  • spec/meilisearch/index/stats_spec.rb

📝 Walkthrough

Walkthrough

The global and index stats methods now accept optional formatting options. The methods pass parsed options to their statistics requests. Tests verify numeric default sizes and human-readable string sizes.

Changes

Stats size formatting

Layer / File(s) Summary
Stats option wiring
lib/meilisearch/client.rb, lib/meilisearch/index.rb
Client#stats and Index#stats accept optional options and pass parsed size_format values to their requests.
Stats response validation
spec/meilisearch/client/stats_spec.rb, spec/meilisearch/index/stats_spec.rb
Tests verify integer size fields by default and string size fields when size_format: :human is used.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3c08a

This localized change adds index size fields and optional formatting to stats responses; no actionable merge-blocking risk remains after normal checks and review.

Possibly related issues

  • meilisearch/meilisearch-rust issue 789: Covers the same size_format behavior for index and global stats APIs.
  • meilisearch/meilisearch-swift issue 521: Covers human-readable size formatting for the same stats endpoints.
  • meilisearch/meilisearch-js issue 2185: Implements equivalent size_format support in the JavaScript SDK.
  • meilisearch/meilisearch-php issue 915: Updates equivalent stats APIs and tests for human-readable database sizes.

Poem

A rabbit checks the stats with care,
Bytes below and words up there.
:human makes the sizes clear,
Index numbers hop without fear.
Tests keep every field in tune.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the addition of index size fields and formatting support to stats responses.
Linked Issues check ✅ Passed The changes forward sizeFormat and test indexSize and usedIndexSize for client and individual index stats.
Out of Scope Changes check ✅ Passed All code and test changes directly support the linked issue objectives for index statistics fields and size formatting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Meilisearch v1.53.0] Add indexSize and usedIndexSize to index stats

1 participant