# Refer to sort values by key/name

**URL:** <https://discuss.elastic.co/t/refer-to-sort-values-by-key-name/10629>\
**Category:** Elasticsearch\
**Created:** [February 5, 2013, 7:52pm UTC](https://discuss.elastic.co/t/refer-to-sort-values-by-key-name/10629 "2013-02-05T19:52:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amnesia7](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@amnesia7](https://discuss.elastic.co/u/amnesia7)\
**Post date:** [February 5, 2013, 7:52pm UTC](https://discuss.elastic.co/t/refer-to-sort-values-by-key-name/10629/1 "2013-02-05T19:52:24Z")

</div>

Hi,

I have added a geo distance filter to my search and I have geo distance as  
one of the multiple columns to sort results on.

My results bring back numbers/scores in the sort array but I was wondering  
whether it was possible to refer to the distance value in the results by  
name/key instead of having to refer to it by the position in the sort array  
depending on how I'm sorting my results.

My results may be sorted _\_geo\_distance,title or title,\_geo\_distance_depending on which the user prefers so I'd like to be able to refer to the  
distance value by a key instead of referring to it by the first or second  
value in the sort array.

I'm already sorting by _\_geo\_distance_ so I assume the value in the sort  
array is the value of _\_geo\_distance_ so it would be good if I could refer  
to value by \*result.\_geo\_distance \*or something like that.

If it makes any difference I'm using the Tire rails gem.

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/refer-to-sort-values-by-key-name/10629/2 "2017-07-06T02:52:53Z")

</div>


