Class SortBuilders

java.lang.Object
org.elasticsearch.search.sort.SortBuilders

public class SortBuilders extends Object
A set of static factory methods for SortBuilders.
  • Constructor Details

    • SortBuilders

      public SortBuilders()
  • Method Details

    • scoreSort

      public static ScoreSortBuilder scoreSort()
      Constructs a new score sort.
    • fieldSort

      public static FieldSortBuilder fieldSort(String field)
      Constructs a new field based sort.
      Parameters:
      field - The field name.
    • pitTiebreaker

      public static FieldSortBuilder pitTiebreaker()
      Constructs a sort tiebreaker that can be used within a point in time reader PointInTimeBuilder.
    • scriptSort

      public static ScriptSortBuilder scriptSort(Script script, ScriptSortBuilder.ScriptSortType type)
      Constructs a new script based sort.
      Parameters:
      script - The script to use.
      type - The type, can either be "string" or "number".
    • geoDistanceSort

      public static GeoDistanceSortBuilder geoDistanceSort(String fieldName, double lat, double lon)
      A geo distance based sort.
      Parameters:
      fieldName - The geo point like field name.
      lat - Latitude of the point to create the range distance facets from.
      lon - Longitude of the point to create the range distance facets from.
    • geoDistanceSort

      public static GeoDistanceSortBuilder geoDistanceSort(String fieldName, GeoPoint... points)
      Constructs a new distance based sort on a geo point like field.
      Parameters:
      fieldName - The geo point like field name.
      points - The points to create the range distance facets from.
    • geoDistanceSort

      public static GeoDistanceSortBuilder geoDistanceSort(String fieldName, String... geohashes)
      Constructs a new distance based sort on a geo point like field.
      Parameters:
      fieldName - The geo point like field name.
      geohashes - The points to create the range distance facets from.