# Ordering of two fields in ELastic, specifically first one is of text and second is from integer

**URL:** <https://discuss.elastic.co/t/ordering-of-two-fields-in-elastic-specifically-first-one-is-of-text-and-second-is-from-integer/321026>\
**Category:** Elasticsearch\
**Created:** [December 12, 2022, 11:50am UTC](https://discuss.elastic.co/t/ordering-of-two-fields-in-elastic-specifically-first-one-is-of-text-and-second-is-from-integer/321026 "2022-12-12T11:50:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvadiga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rvadiga/32/102601_2.png) [@rvadiga](https://discuss.elastic.co/u/rvadiga)\
**Post date:** [December 12, 2022, 11:50am UTC](https://discuss.elastic.co/t/ordering-of-two-fields-in-elastic-specifically-first-one-is-of-text-and-second-is-from-integer/321026/1 "2022-12-12T11:50:12Z")

</div>

Hi Team,  
Could someone please show hints to implement the below requirement?  
I have an index where two fields, first one is text field, and second is of integer. I need to take the highest number row from the unique(first and second fields) using Query DSL.

## Example: FirstField, SecondField

abc, 1  
abc, 2  
abc. 3  
dac, 1  
dac, 2  
dac, 5

Expected result would be:  
rows (abc,3), and (dac,5).  
Please shred some light of formatting the DSL query.

Thanks  
Venkatesh

---

<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:** [January 9, 2023, 11:50am UTC](https://discuss.elastic.co/t/ordering-of-two-fields-in-elastic-specifically-first-one-is-of-text-and-second-is-from-integer/321026/2 "2023-01-09T11:50:34Z")

</div>

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