IIRC for this you need to help Elasticsearch determine the correct mapping. You will probably want to specify that you'd like to use nested objects and execute a count query against those. For more information check out https://www.elastic.co/guide/en/elasticsearch/reference/2.x/nested.html
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.