# Seek for best indexing solutions, count who purchase most number of books?

**URL:** <https://discuss.elastic.co/t/seek-for-best-indexing-solutions-count-who-purchase-most-number-of-books/25484>\
**Category:** Elasticsearch\
**Created:** [July 13, 2015, 9:39pm UTC](https://discuss.elastic.co/t/seek-for-best-indexing-solutions-count-who-purchase-most-number-of-books/25484 "2015-07-13T21:39:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![linlma](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@linlma](https://discuss.elastic.co/u/linlma)\
**Post date:** [July 13, 2015, 9:39pm UTC](https://discuss.elastic.co/t/seek-for-best-indexing-solutions-count-who-purchase-most-number-of-books/25484/1 "2015-07-13T21:39:17Z")

</div>

Hello everyone,

I want to count top N book buyers. I have data like this,

1. For book 1, user 1, user 2 and user 3 purchased;
2. For book 2, user 2 and user 3 purchased;
3. For book 3, user 3 and user 4 purchased.

If I want to select top 3 book buyers, they are user 3, user 2 and user 1 (or user 4).

Any thoughts how to index book purchase information and select top N buyers, is highly appreciated.

BTW, I just need to count for top N, no need for sorting inside top N.

thanks in advance,  
Lin

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:01am UTC](https://discuss.elastic.co/t/seek-for-best-indexing-solutions-count-who-purchase-most-number-of-books/25484/2 "2017-07-06T00:01:44Z")

</div>

Closed on July 6, 2017, 12:01am UTC


