jeudi 19 février 2015

elasticsearch top_hits aggregation sorted by geolocation distance


Vote count:

0




In elasticsearch-1.3.7 I want to run a top_hits aggregation sorted by each top_hits geolocation distance.


Here is how I am using the top_hits agg, I have everything working and sorting with a script but I can't figure out how to sort by geolocation distance:



{
"aggs": {
"rollup": {
"terms": {
"field": "offer_store.store_key",
"size": 10,
"order": {
"order_by_value": "desc"
}
},
"aggs": {
"offers": {
"top_hits": {
"size": 1,
"sort": [
{
"offer_value": {
"order": "desc"
}
}
]
}
},
"order_by_value": {
"max": {
"field": "offer_value"
}
}
}
}
},
"size": 1,
"from": 0
}


This was all of the documentation I could find on sorting by a metric, but nothing about geolocation.



asked 10 secs ago







elasticsearch top_hits aggregation sorted by geolocation distance

Aucun commentaire:

Enregistrer un commentaire