Skip to content

always getting Infinity in geo_distance sorting #2364

@SirCameron

Description

@SirCameron

Question

I have an index:

{
      index: 'discoveries',
      mappings: {
        properties: {
          id: { type: 'integer' },
          description: { type: 'text' },
          location: { type: 'geo_point' },
        },
      },
    }

when I run a query like this:

      index: 'discoveries',
      query: {
        match: {
          description: {
            query: 'some text',
          },
        },
      },
      sort: [
        {
          _geo_distance: {
            location: [location.longitude, location.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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions