Class GeoDistanceSortBuilder

    • Constructor Detail

      • GeoDistanceSortBuilder

        public GeoDistanceSortBuilder​(java.lang.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.
      • GeoDistanceSortBuilder

        public GeoDistanceSortBuilder​(java.lang.String fieldName,
                                      double lat,
                                      double lon)
        Constructs a new distance based sort on a geo point like field.
        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.
      • GeoDistanceSortBuilder

        public GeoDistanceSortBuilder​(java.lang.String fieldName,
                                      java.lang.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.
      • GeoDistanceSortBuilder

        public GeoDistanceSortBuilder​(StreamInput in)
                               throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • writeTo

        public void writeTo​(StreamOutput out)
                     throws java.io.IOException
        Description copied from interface: Writeable
        Write this into the StreamOutput.
        Throws:
        java.io.IOException
      • fieldName

        public java.lang.String fieldName()
        Returns the geo point like field the distance based sort operates on.
      • point

        public GeoDistanceSortBuilder point​(double lat,
                                            double lon)
        The point to create the range distance facets from.
        Parameters:
        lat - latitude.
        lon - longitude.
      • points

        public GeoDistanceSortBuilder points​(GeoPoint... points)
        The point to create the range distance facets from.
        Parameters:
        points - reference points.
      • points

        public GeoPoint[] points()
        Returns the points to create the range distance facets from.
      • geoDistance

        public GeoDistance geoDistance()
        Returns the geo distance type used to compute the distance.
      • validation

        public GeoValidationMethod validation()
        Returns the validation method to use for this sort builder.
      • sortMode

        public GeoDistanceSortBuilder sortMode​(SortMode sortMode)
        Defines which distance to use for sorting in the case a document contains multiple geo points. Possible values: min and max
      • sortMode

        public SortMode sortMode()
        Returns which distance to use for sorting in the case a document contains multiple geo points.
      • setNestedPath

        @Deprecated
        public GeoDistanceSortBuilder setNestedPath​(java.lang.String nestedPath)
        Deprecated.
        set nested sort with setNestedSort(NestedSortBuilder) and retrieve with getNestedSort()
        Sets the nested path if sorting occurs on a field that is inside a nested object. By default when sorting on a field inside a nested object, the nearest upper nested object is selected as nested path.
      • getNestedPath

        @Deprecated
        public java.lang.String getNestedPath()
        Deprecated.
        set nested sort with setNestedSort(NestedSortBuilder) and retrieve with getNestedSort()
        Returns the nested path if sorting occurs on a field that is inside a nested object. By default when sorting on a field inside a nested object, the nearest upper nested object is selected as nested path.
      • ignoreUnmapped

        public boolean ignoreUnmapped()
        Returns true if unmapped geo fields should be treated as located at an infinite distance
      • getWriteableName

        public java.lang.String getWriteableName()
        Description copied from interface: NamedWriteable
        Returns the name of the writeable object
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • fromXContent

        public static GeoDistanceSortBuilder fromXContent​(XContentParser parser,
                                                          java.lang.String elementName)
                                                   throws java.io.IOException
        Creates a new GeoDistanceSortBuilder from the query held by the XContentParser in XContent format.
        Parameters:
        parser - the input parser. The state on the parser contained in this context will be changed as a side effect of this method call
        elementName - in some sort syntax variations the field name precedes the xContent object that specifies further parameters, e.g. in '{ "foo": { "order" : "asc"} }'. When parsing the inner object, the field name can be passed in via this argument
        Throws:
        java.io.IOException
      • rewrite

        public GeoDistanceSortBuilder rewrite​(QueryRewriteContext ctx)
                                       throws java.io.IOException
        Description copied from interface: Rewriteable
        Rewrites this instance based on the provided context. The returned objects will be the same instance as this if no changes during the rewrite were applied.
        Throws:
        java.io.IOException