0
votes

I have a documents something like bellow

{ "_index": "lines", "_type": "lineitems", "_id": "4002_11", "_score": 2.6288738, "_source": { "data": { "type": "Shirt" } } }

I want to get a count based on type attribute value. Any suggestion on this?

I tried term query but no lick with that.

1

1 Answers

0
votes

You should use the terms aggregation, this will return the number of documents aggregated for each "type" field values.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html