When sorting by distance truncating the distance sort value for fallback sort criteria

Hello all,

We're sorting with elasticsearch like so:

  {
      "size": 300,
      "from": 0,
      "sort": [
        {
          "_geo_distance": {
            "geoLocation": {
              "lat": 29.7407,
              "lon": -95.4636
            },
            "distance_type": "arc",
            "unit": "mi",
            "order": "asc"
          }
        },
        {
          "profileCompletenessPercentage": "desc"
        },
        {
          "galleryPhotoCount": "desc"
        }
      ],
      "query": {
        "bool": {
          "filter": {
            "geo_distance": {
              "geoLocation": {
                "lat": 29.7407,
                "lon": -95.4636
              },
              "distance_type": "arc",
              "distance": "10mi"
            }
          }
        }
      },
      "aggs": {
        "totals": {
          "global": {
            
          }
        }
      }
    }

The distance values are 17 decimal places "sort":[4.230084424066245,50,0] so our secondary sort criteria is never hit because we want a precision of one decimal place.

How can we accomplish our goal of multi-sort with Elasticsearch where the precision for geolocation is 4.2 not 4.230084424066245?

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