Number of document of all indices with a single request

I'm trying to find a tip to retrieve the document count of each index
in elastic with a single request
Ex: in elastic there is:
Index1 with 10 document,
Index2 with 20 document,
Index3 with 30 document,
Index4 with 40 document,
Index5 with 50 document,

GET Index1/_count ==> 10
GET Index2/_count ==> 20

GET Index*/_count ==> 150 this is the total of documents from all indices

Do you have any idea how to do it
to have a return as follows: ?
"Index1": 10,
"Index2": 20,
"Index3" : 30,
"Index4": 40 ,
"Index5" : 50


You can do something like:

GET /_search?filter_path=aggregations.index.buckets
  "size": 0,
  "aggs": {
    "index": {
      "terms": {
        "field": "_index",
        "size": 1000

But this is may be better:

GET /_cat/indices?v&h=index,dc


GET /_cat/indices?v&h=index,dc&format=json

Thank you for the answer,
The first request works very well

however we cannot use a request : _cat/indices
because it does not return the number of document on elastic but it is based on the Lucene engine to return information that does not correspond to a count

thanks again

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.