public void CreateGeoShapePolygonMapping() { var geoShapePolygonDto = new GeoShapePolygonDto { Coordinates = new GeoShapePolygon { Coordinates = new List <List <GeoPoint> > { // [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] new List <GeoPoint> { new GeoPoint(100, 0), new GeoPoint(101, 0), new GeoPoint(101, 1), new GeoPoint(100, 1), new GeoPoint(100, 0) }, // [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] new List <GeoPoint> { new GeoPoint(100.2, 0.2), new GeoPoint(100.8, 0.2), new GeoPoint(100.8, 0.8), new GeoPoint(100.2, 0.8), new GeoPoint(100.2, 0.2) } } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate <GeoShapePolygonDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists <GeoShapePolygonDto>()); context.AddUpdateDocument(geoShapePolygonDto, geoShapePolygonDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count <GeoShapePolygonDto>()); var result = context.SearchById <GeoShapePolygonDto>(1); Assert.AreEqual(geoShapePolygonDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }
public void CreateGeoShapePolygonMapping() { var geoShapePolygonDto = new GeoShapePolygonDto { Coordinates = new GeoShapePolygon { Coordinates = new List<List<GeoPoint>> { // [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] new List<GeoPoint> { new GeoPoint(100, 0), new GeoPoint(101, 0), new GeoPoint(101, 1), new GeoPoint(100, 1), new GeoPoint(100, 0) }, // [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] new List<GeoPoint> { new GeoPoint(100.2, 0.2), new GeoPoint(100.8, 0.2), new GeoPoint(100.8, 0.8), new GeoPoint(100.2, 0.8), new GeoPoint(100.2, 0.2) } } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate<GeoShapePolygonDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists<GeoShapePolygonDto>()); context.AddUpdateDocument(geoShapePolygonDto, geoShapePolygonDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1,context.Count<GeoShapePolygonDto>()); var result = context.SearchById<GeoShapePolygonDto>(1); Assert.AreEqual(geoShapePolygonDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }