The Closer, The Better - nested geo_distance and scoring

Is it feasible to do a geo_distance query with an efficient scoring, in the following way?

Each document might have up to 10 nested objects with a field "location" as type geo_pointincluded. I'd like to retrieve, sort and score documents based on the "location", but the scoring should be done based on the "closest" of all the nested objects that each document have. I might not getting valid results, since it seems that all the results have very, very similar scores.

Please take a look onto my query:

GET /whatever/couchbaseDocument/_search
{
"size": 1000,
"query": {
"nested": {
"path": "doc.inheritedProperties.places",
"query": {
"function_score": {
"functions": [
{
"linear": {
"doc.inheritedProperties.places.location.coordinates": {
"origin": {
"lat": 43.000,
"lon": 46.000
},
"scale": "1km",
"offset": "0km",
"decay": 0.5
}
},
"weight": 3
}
],
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "100km",
"doc.inheritedProperties.places.location.coordinates": {
"lat": 43.0000,
"lon": 46.0000
}
}
}
}
},
"score_mode": "multiply"
}
}
}
}
}

I've got 10000 documents indexed with coordinates uniformly random between 40.0 - 50.0 as for lon and lat.

The score is "_score": 0.5936181 for the first 50 retrieved documents, and then "_score": 0.026814064 for the next 50. I've also tried to tweak the parameters of the scoring functions as well as trying out different decays. Same results, but with different scores: top 50 or so documents have the same score.

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