NOTE: You are looking at documentation for an older release. 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.LocationShape) .IndexedShape(p => p .Id(Project.Instance.Name) .Path(pp => pp.LocationShape) .Routing(Project.Instance.Name) ) .Relation(GeoShapeRelation.Intersects) )
Object Initializer syntax example
editnew GeoIndexedShapeQuery { Name = "named_query", Boost = 1.1, Field = Field<Project>(p => p.LocationShape), IndexedShape = new FieldLookup { Id = Project.Instance.Name, Index = Index<Project>(), Type = Type<Project>(), Path = Field<Project>(p => p.LocationShape), Routing = Project.Instance.Name }, Relation = GeoShapeRelation.Intersects }
Example json output.
{ "geo_shape": { "_name": "named_query", "boost": 1.1, "locationShape": { "indexed_shape": { "id": "Durgan LLC", "index": "project", "type": "doc", "path": "locationShape", "routing": "Durgan LLC" }, "relation": "intersects" } } }