# I would like to inquire that there are more than one field value for the entire document

**URL:** <https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259>\
**Category:** Elasticsearch\
**Created:** [March 5, 2020, 10:05am UTC](https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259 "2020-03-05T10:05:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sihwan](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@Sihwan](https://discuss.elastic.co/u/Sihwan)\
**Post date:** [March 5, 2020, 10:05am UTC](https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259/1 "2020-03-05T10:05:05Z")

</div>

If you look at MS-SQL queries  
select T1.column1 AS 'A'  
, count(T1.column1) AS 'C'  
from Table1 T1  
group by column1  
having count(column1) \> 1

But I would like to have a lookup at the elastic  
Will it be possible?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 5, 2020, 7:28pm UTC](https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259/2 "2020-03-05T19:28:45Z")

</div>

It's been a while since I did SQL, but look at using a [terms aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/search-aggregations-bucket-terms-aggregation.html) on the `column1` field.

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [March 6, 2020, 7:53am UTC](https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259/3 "2020-03-06T07:53:51Z")

</div>

@Sihwan or you could try [the `_sql` endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/xpack-sql.html) with that exact same query. If it works for you and don't want to use SQL, maybe [the `translate` call](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/sql-translate.html) will help you to get a useful ES query DSL instead.

---

<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:** [April 3, 2020, 7:54am UTC](https://discuss.elastic.co/t/i-would-like-to-inquire-that-there-are-more-than-one-field-value-for-the-entire-document/222259/4 "2020-04-03T07:54:03Z")

</div>

Closed on April 3, 2020, 7:54am UTC

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