Hi,
I need to set score by distance and I found good example - https://www.elastic.co/guide/en/elasticsearch/guide/current/decay-functions.html - but it looks not working in my case.
My request:
GET earth/destination/_search?_source=country_name,city_name,location&size=3
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"gauss": {
"location": {
"origin": { "lat": 0, "lon": 50 },
"scale": "10km"
}
}
}
]
}
}
}
My response:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"failed": 0
},
"hits": {
"total": 572,
"max_score": 0,
"hits": [
{
"_index": "earth",
"_type": "destination",
"_id": "450",
"_score": 0,
"_source": {
"city_name": "Piran",
"country_name": "Slovenia",
"location": {
"lon": "13.5682895",
"lat": "45.528319"
}
}
},
{
"_index": "earth",
"_type": "destination",
"_id": "452",
"_score": 0,
"_source": {
"city_name": "Dubai",
"country_name": "United Arab Emirates",
"location": {
"lon": "55.307485",
"lat": "25.271139"
}
}
},
{
"_index": "earth",
"_type": "destination",
"_id": "462",
"_score": 0,
"_source": {
"city_name": "Villefranche-Sur-Mer",
"country_name": "France",
"location": {
"lon": "7.311109",
"lat": "43.703976"
}
}
}
]
}
}
So, all scores are 0. What's wrong in my request?