Return distance when using location-based scoring

I use function_score to create my custom score based on the distance
between the user and a place.

"function_score": {
"functions": [
{
"gauss": {
"location": {
"origin": "47.3942675,0.6949399",
"scale": "40km",
"decay": 0.5
}
}
}
],
"query": { ... // my query

It works quite well. But I wan't ElasticSearch to return the distance (in
km) for each result. I added:

"sort" : [
{
"_geo_distance" : {
"location" : [0.6949399,47.3942675],
"order" : "asc",
"unit" : "km"
}
}
]

I was wondering... is it the proper way to do it ? Does it force ES to
calculate the distance twice (for scoring & sorting) ? or is it just ok ?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9e5d1312-130a-4979-9651-4f5adaaadc6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.