ElasticSearch: Query to get count of objects in a nested field

Hello Everyone,

I needed some help please.
I needed to create a count query on nested objects in a field, across all
documents. Each document json has a many fields. One particular field
called "hotlinks" comprises of many internal dynamic object fields.

Doc1:
{
hotlinks : { 112222:{....} , 333333: {.....} , 545555: {.....} }
}

Doc2:
{
hotlinks : { 67756:{....} , 756767: {.....} , 1111111: {.....} }
}

Each document has a hotlinks fields. The hotlinks field comprises of varied
inner hotlink objects. Each key is a java unique id and has objects that
contain data (inner fields)
I needed a way to get the count of all the inner nested objects of the
field – ‘hotlinks’. For example the summation of inner objects of hotlinks
in doc1 and doc2 would be 6. Is there any way to do this in ES via a single
query to get the count across all documents.

Thanks a lot,
Karan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.