GeoShape Query

edit

Query version of the geo_shape Filter.

Requires the geo_shape Mapping.

Given a document that looks like this:

{
    "name": "Wind & Wetter, Berlin, Germany",
    "location": {
        "type": "Point",
        "coordinates": [13.400544, 52.530286]
    }
}

The following query will find the point:

{
    "query": {
        "geo_shape": {
            "location": {
                "shape": {
                    "type": "envelope",
                    "coordinates": [[13, 53],[14, 52]]
                }
            }
        }
    }
}

See the Filter’s documentation for more information.

Relevancy and Score

edit

Currently Elasticsearch does not have any notion of geo shape relevancy, consequently the Query internally uses a constant_score Query which wraps a geo_shape filter.

Spatial Relations

edit

The geo_shape strategy mapping parameter determines which spatial relation operators may be used at search time.

The following is a complete list of spatial relation operators available:

  • INTERSECTS - (default) Return all documents whose geo_shape field intersects the query geometry.
  • DISJOINT - Return all documents whose geo_shape field has nothing in common with the query geometry.
  • WITHIN - Return all documents whose geo_shape field is within the query geometry.