I have an index:
{
index: 'discoveries',
mappings: {
properties: {
id: { type: 'integer' },
description: { type: 'text' },
location: { type: 'geo_point' },
},
},
}
I index some data like:
{
refresh: true,
id: 'some id',
index: "discoveries",
document: {
id: 'some id',
description: 'description',
location: {
type: "Point",
coordinates: [longitude, latitude],
},
},
}
when I run a query like this:
{
index: 'discoveries',
query: {
match: {
description: {
query: 'some text',
},
},
},
sort: [
{
_geo_distance: {
location: [longitude,latitude],
order: 'desc',
unit: 'km',
mode: 'median',
distance_type: 'arc',
ignore_unmapped: true,
},
},
],
}
This always returns Infinity for the _geo_distance sort... always...
Has anyone else experienced this? is there something obvious I'm missing?
This is running locally with docker, using the javascript lib..
If I set ignore_unmapped
to false, I get the error illegal_argument_exception: failed to find mapper for [location] for geo distance based sort
.
So this points to location not being mapped correctly, but I map it when creating the index