How to find count of inner hits?

And part of sample output:

{
  "took" : 35,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 43,
    "max_score" : 0.0,
    "hits" : [
      {
        "_index" : "bookings",
        "_type" : "booking",
        "_id" : "AWBqF7CaV4SPSy5IHUz9",
        "_score" : 0.0,
        "inner_hits" : {
          "segment" : {
            "hits" : {
              "total" : 1,
              "max_score" : 0.0,
              "hits" : [
                {
                  "_nested" : {
                    "field" : "segment",
                    "offset" : 0
                  },
                  "_score" : 0.0,
                  "inner_hits" : {
                    "segment.item" : {
                      "hits" : {
                        "total" : 1,
                        "max_score" : 1.1799169,
                        "hits" : [
                          {
                            "_nested" : {
                              "field" : "segment",
                              "offset" : 0,
                              "_nested" : {
                                "field" : "item",
                                "offset" : 0
                              }
                            },
                            "_score" : 1.1799169,
                            "_source" : {
                              "cancel_timestamp" : "2017-10-18T10:31:25.086",
                              "product_type" : "ST",
                              "item_id" : 1565994,
                              "carriage_number" : "3",
                              "product_code" : "14091521ST",
                              "ticket_number" : "345727",
                              "inventory_class" : "O5"
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      {
        "_index" : "bookings",
        "_type" : "booking",
        "_id" : "AWBqF7CaV4SPSy5IHU0W",
        "_score" : 0.0,
        "inner_hits" : {
          "segment" : {
            "hits" : {
              "total" : 1,
              "max_score" : 0.0,
              "hits" : [
                {
                  "_nested" : {
                    "field" : "segment",
                    "offset" : 0
                  },
                  "_score" : 0.0,
                  "inner_hits" : {
                    "segment.item" : {
                      "hits" : {
                        "total" : 1,
                        "max_score" : 1.1799169,
                        "hits" : [
                          {
                            "_nested" : {
                              "field" : "segment",
                              "offset" : 0,
                              "_nested" : {
                                "field" : "item",
                                "offset" : 0
                              }
                            },
                            "_score" : 1.1799169,
                            "_source" : {
                              "cancel_timestamp" : "2017-10-18T13:38:52.066",
                              "product_type" : "ST",
                              "item_id" : 1566020,
                              "carriage_number" : "3",
                              "product_code" : "14091521ST",
                              "ticket_number" : "205184",
                              "inventory_class" : "O5"
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
...