You're seeing just the function geo_distance_sort, go back to ExAliyunOts.Search module for more information.
Link to this function

geo_distance_sort(field_name, points, options)

View Source


geo_distance_sort(field_name(), points :: list(), options()) :: map()

Geographic distance sorting, according to the sum of distances between to the input geographical points, sort by the minimum/maximum/average summation value.


import MyApp.TableStore

search "table", "index_name",
  search_query: [
    query: geo_distance_query("location", 500_000, "5,5"),
    sort: [
      geo_distance_sort("location", ["5.14,5.21"], order: :asc)

The input points are a list of string, each format as "$latitude,$longitude".


  • :order, optional, available options are :asc | :desc;
  • :mode, optional, used for nested type field within integer or float, as :min will sort by the minimum value of items, as :max will sort by the maximum value of items, as :avg will sort by the average value of items, by default it's :nil;
  • :distance_type, optional, available options are :arc | :plane, as :arc means distance calculated by arc surface, as :plane means distance calculated by plane.