public void CreateGeoShapeMultiPolygonMapping() { var geoShapeMultiPolygonDto = new GeoShapeMultiPolygonDto { Coordinates = new GeoShapeMultiPolygon { Coordinates = new List <List <List <GeoPoint> > > { 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 <GeoShapeMultiPolygonDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists <GeoShapeMultiPolygonDto>()); context.AddUpdateDocument(geoShapeMultiPolygonDto, geoShapeMultiPolygonDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count <GeoShapeMultiPolygonDto>()); var result = context.SearchById <GeoShapeMultiPolygonDto>(1); Assert.AreEqual(geoShapeMultiPolygonDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }
public void CreateGeoShapeMultiPolygonMapping() { var geoShapeMultiPolygonDto = new GeoShapeMultiPolygonDto { Coordinates = new GeoShapeMultiPolygon { Coordinates = new List<List<List<GeoPoint>>> { 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<GeoShapeMultiPolygonDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists<GeoShapeMultiPolygonDto>()); context.AddUpdateDocument(geoShapeMultiPolygonDto, geoShapeMultiPolygonDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count<GeoShapeMultiPolygonDto>()); var result = context.SearchById<GeoShapeMultiPolygonDto>(1); Assert.AreEqual(geoShapeMultiPolygonDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }