Skip to content

Add indexSize and usedIndexSize to index stats - #1276

Merged
sanders41 merged 2 commits into
meilisearch:mainfrom
vivek378521:feat/index-stats-size
Aug 28, 2026
Merged

Add indexSize and usedIndexSize to index stats#1276
sanders41 merged 2 commits into
meilisearch:mainfrom
vivek378521:feat/index-stats-size

Conversation

@vivek378521

@vivek378521 vivek378521 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Related issue

Fixes #1274

What does this PR do?

Adds indexSize and usedIndexSize to the per-index stats response, matching Meilisearch v1.53.0.

  • IndexStats now exposes optional index_size / used_index_size fields
  • Values are integers (bytes) by default, or human-readable strings when sizeFormat=human
  • Fields are None when absent, remaining backward compatible with older Meilisearch versions
  • Updated integration tests for both index stats and all-indexes stats endpoints

PR checklist

Please check if your PR fulfills the following requirements:

  • [ x] Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • [ x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • [ x] Have you read the contributing guidelines?
  • [ x] Have you made sure that the title is accurate and descriptive of the changes?

Used opencode (AI coding assistant) to implement the model changes and update tests. All changes reviewed and verified by the author against a live Meilisearch v1.53.1 instance.

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • New Features
    • Index statistics now include total and used index sizes.
    • Size values are available as integers or human-readable strings, depending on the requested format.
  • Tests
    • Added coverage to verify index size fields and their formatting across statistics responses.
  • Documentation
    • Updated contributor and README examples for improved formatting and consistency.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

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: 5862e987-4428-4063-b594-2d1ec958947e

📥 Commits

Reviewing files that changed from the base of the PR and between 3073134 and cc34e43.

📒 Files selected for processing (2)
  • CONTRIBUTING.md
  • README.md

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The SDK adds index_size and used_index_size to IndexStats. Tests verify integer values for default responses and formatted strings for human-readable responses. Documentation examples receive formatting-only updates.

Changes

Index statistics fields

Layer / File(s) Summary
Index statistics response fields
meilisearch/models/index.py
IndexStats now includes optional index_size and used_index_size fields with integer, string, or null values.
Statistics response validation
tests/client/test_client_stats_meilisearch.py, tests/index/test_index_stats_meilisearch.py
Tests verify both fields in per-index and all-index statistics responses. Tests also verify positive integers by default and formatted strings when sizeFormat is enabled.

Documentation formatting

Layer / File(s) Summary
Documentation examples and guidance
CONTRIBUTING.md, README.md
Examples use updated quote, indentation, line-break, and comment formatting. No functional behavior changes are made.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to cc34e

This PR adds optional per-index size fields while preserving compatibility with older responses; no actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit checks the index bytes,
Two new fields hop into sight,
Numbers count the pages used,
Human sizes glow in flight,
Tests nod softly: all is right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The model and test changes are in scope. The CONTRIBUTING.md comment edit and the README formatting changes are unrelated to issue #1274. Remove the unrelated CONTRIBUTING.md and README formatting changes, or explain and link them to a separate objective or issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of indexSize and usedIndexSize to index statistics, which is the primary change.
Linked Issues check ✅ Passed The PR adds index_size and used_index_size to IndexStats and updates tests for per-index and all-index statistics, including byte and human-readable formats. This satisfies issue #1274.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (2 skipped: 2 …
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@vivek378521

Copy link
Copy Markdown
Contributor Author

@Strift The ruff check was failing on README and CONTRIBUTING file, but that had nothing to do with this PR, I have run the linter check on those 2 files also so the tests now all pass.

Let me know if I should revert that particular commit. Without that commit linter check fails on README and CONTRIBUTING.

Either we remove those files from the ruff check or we merge this PR so the lint check stops failing.

Thanks!

@DhavalGojiya

Copy link
Copy Markdown
Contributor

The ruff check was failing on README and CONTRIBUTING file

I think you can keep these changes in this PR. The new version of Ruff now supports more advanced formatting, even for code blocks in the README, so I don't think it's an issue.

@sanders41 sanders41 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vivek378521

@sanders41 sanders41 added the enhancement New feature or request label Aug 28, 2026
@sanders41
sanders41 added this pull request to the merge queue Aug 28, 2026
Merged via the queue into meilisearch:main with commit 80a562f Aug 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants