How to analyze how many documents for specific key's each value

I have a like_to_article Index with 250,000 documents.
This index has article_id key.

To analyze how many documents for each article_id key, how can I do that even if there are 250,000 docs?

for incetance...

  • article_id aaa -> 500 docs
  • article_id bbb -> 1000 docs

The one way to do that I thought, take 10,000 documents, this is max when fetch docs, 25 times, then parse the response.

I don't want to do that because this is over work a bit, only need number. Moreover, taking 10,000 docs 25times is too hard to do.

Any ideas, thank you.

Take a look at the terms aggregation, allowing you to count occurences of a field value in an index.

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