# Elasticquery

**URL:** <https://discuss.elastic.co/t/elasticquery/168939>\
**Category:** Elasticsearch\
**Created:** [February 19, 2019, 6:37am UTC](https://discuss.elastic.co/t/elasticquery/168939 "2019-02-19T06:37:04Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 19, 2019, 9:20am UTC](https://discuss.elastic.co/t/elasticquery/168939/9 "2019-02-19T09:20:01Z")

</div>

> [@niraj\_pandey](#):
>
> Let me give the complete example here:

That would help not spending time with wrong answers. Please do that next time.

It's always better to provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It helps to better understand what you are doing.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Anyway, you can run a `terms` aggregation and then a `top_hits` agg with `size:1` in it.

---

_[View the full topic](https://discuss.elastic.co/t/elasticquery/168939)._
