Retrieving index statistics and document count

You can use the readSearchIndexStatistics API to query an index name or the index identifier to get the document count and numerous other statistics for the index or indices recognized by the identifier. You can also list all the available indices by using the index identifier.

Elasticsearch provides comprehensive actionable statistics. You can use the readSearchIndexStatistics API to fetch the statistics exposed by Elasticsearch. For more information about the statistics exposed by Elasticsearch, see Index statistics. As the search operations rely on index, the API is designed to fetch statistics at the index level.

As the data in your index grows, your search queries might become slow in retrieving the information that is needed. In such a case, you can view the statistics for your search operations. Based on the statistics, you can decide on creating a new index.

You can also use the readSearchIndexStatistics API and query by using the index identifier to enlist all available indices.