Counting shards was wrong if one of the indices was in the RED status

Closes #4528