WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Geo Shape Indexed Shape Query Usage
editGeo Shape Indexed Shape Query Usage
editThe GeoShape IndexedShape Query supports using a shape which has already been indexed in another index and/or index type within a geoshape query. This is particularly useful for when you have a pre-defined list of shapes which are useful to your application and you want to reference this using a logical name (for example New Zealand), rather than having to provide their coordinates within the request each time.
See the Elasticsearch documentation on geoshape queries for more detail.
Fluent DSL example
editq .GeoIndexedShape(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Location) .IndexedShape(p => p .Id(2) .Path(pp => pp.Location) ) .Relation(GeoShapeRelation.Intersects) )
Object Initializer syntax example
editnew GeoIndexedShapeQuery { Name = "named_query", Boost = 1.1, Field = Field<Project>(p => p.Location), IndexedShape = new FieldLookup { Id = 2, Index = Index<Project>(), Type = Type<Project>(), Path = Field<Project>(p => p.Location), }, Relation = GeoShapeRelation.Intersects }
Example json output.
{ "geo_shape": { "_name": "named_query", "boost": 1.1, "location": { "indexed_shape": { "id": 2, "type": "project", "index": "project", "path": "location" }, "relation": "intersects" } } }