Skip to content

[BUG] FT.INFO num_docs is doubled because of replication #6964

@nantiferov

Description

@nantiferov

Describe the bug

I noticed that FT.INFO num_docs returns incorrect numbers because it seems it includes replication factor. i.e. when there is master + 1 replica, num_docs is doubled.

To Reproduce

Steps to reproduce the behavior:

  1. Create index with documents in setup with 1 master + 1 replica
  2. Check FT.SEARCH result with limit 0 0. Quote: "You can use LIMIT 0 0 to count the number of documents in the result set without actually returning them."
  3. Check FT.INFO , num_docs field. Value will be equal result of FT.SEARCH ... limit 0 0 multiplied by 2.

Expected behavior

From my understanding, num_docs should show amount of docs in search index without taking into account replication factor. Also I checked other fields in FT.INFO output and they don't match FT.SEARCH results either.

Maybe some other field should be added to not break existing monitoring, but I believe it would be useful to have metric which shows amount of documents in search index without multiplication by replicas count.

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Version/branch: Redis v8.0, but I think it's reproducible on v7.4 as well

Additional context

None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions