Class GeoBoundingBoxQueryBuilder

    • Field Detail

      • DEFAULT_TYPE

        public static final GeoExecType DEFAULT_TYPE
        Default type for executing this query (memory as of this writing).
      • DEFAULT_IGNORE_UNMAPPED

        public static final boolean DEFAULT_IGNORE_UNMAPPED
        The default value for ignore_unmapped.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GeoBoundingBoxQueryBuilder

        public GeoBoundingBoxQueryBuilder​(java.lang.String fieldName)
        Create new bounding box query.
        Parameters:
        fieldName - name of index field containing geo coordinates to operate on.
      • GeoBoundingBoxQueryBuilder

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

      • setCorners

        public GeoBoundingBoxQueryBuilder setCorners​(double top,
                                                     double left,
                                                     double bottom,
                                                     double right)
        Adds top left point.
        Parameters:
        top - The top latitude
        left - The left longitude
        bottom - The bottom latitude
        right - The right longitude
      • setCorners

        public GeoBoundingBoxQueryBuilder setCorners​(java.lang.String geohash)
        Adds points from a single geohash.
        Parameters:
        geohash - The geohash for computing the bounding box.
      • setCorners

        public GeoBoundingBoxQueryBuilder setCorners​(java.lang.String topLeft,
                                                     java.lang.String bottomRight)
        Adds points.
        Parameters:
        topLeft - topLeft point to add as geohash.
        bottomRight - bottomRight point to add as geohash.
      • topLeft

        public GeoPoint topLeft()
        Returns the top left corner of the bounding box.
      • bottomRight

        public GeoPoint bottomRight()
        Returns the bottom right corner of the bounding box.
      • setCornersOGC

        public GeoBoundingBoxQueryBuilder setCornersOGC​(GeoPoint bottomLeft,
                                                        GeoPoint topRight)
        Adds corners in OGC standard bbox/ envelop format.
        Parameters:
        bottomLeft - bottom left corner of bounding box.
        topRight - top right corner of bounding box.
      • setCornersOGC

        public GeoBoundingBoxQueryBuilder setCornersOGC​(java.lang.String bottomLeft,
                                                        java.lang.String topRight)
        Adds corners in OGC standard bbox/ envelop format.
        Parameters:
        bottomLeft - bottom left corner geohash.
        topRight - top right corner geohash.
      • setValidationMethod

        public GeoBoundingBoxQueryBuilder setValidationMethod​(GeoValidationMethod method)
        Specify whether or not to ignore validation errors of bounding boxes. Can only be set if coerce set to false, otherwise calling this method has no effect.
      • getValidationMethod

        public GeoValidationMethod getValidationMethod()
        Returns geo coordinate validation method to use.
      • type

        public GeoExecType type()
        Returns the execution type of the geo bounding box.
      • fieldName

        public java.lang.String fieldName()
        Returns the name of the field to base the bounding box computation on.
      • ignoreUnmapped

        public GeoBoundingBoxQueryBuilder ignoreUnmapped​(boolean ignoreUnmapped)
        Sets whether the query builder should ignore unmapped fields (and run a MatchNoDocsQuery in place of this query) or throw an exception if the field is unmapped.
      • ignoreUnmapped

        public boolean ignoreUnmapped()
        Gets whether the query builder will ignore unmapped fields (and run a MatchNoDocsQuery in place of this query) or throw an exception if the field is unmapped.
      • getWriteableName

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