@ash7f Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
You can leverage the $count=true to get the number of matches found in an index. On an empty search, count is the total number of documents in the index. On a qualified search, it's the number of documents matching the query input.
Feel free to reach back to me if you have any further questions on this.