public void CreateGeoShapeGeometryCollectionMapping() { var geoShapeGeometryCollectionDto = new GeoShapeGeometryCollectionDto { Coordinates = new GeoShapeGeometryCollection { Geometries = new List <object> { new GeoShapeMultiLineString { 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) } } }, new GeoShapePoint { Coordinates = new GeoPoint(45, 45) }, new GeoShapeLineString { Coordinates = new List <GeoPoint> { new GeoPoint(45, 45), new GeoPoint(46, 45) } } } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate <GeoShapeGeometryCollectionDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists <GeoShapeGeometryCollectionDto>()); context.AddUpdateDocument(geoShapeGeometryCollectionDto, geoShapeGeometryCollectionDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count <GeoShapeGeometryCollectionDto>()); var result = context.SearchById <GeoShapeGeometryCollectionDto>(1); Assert.AreEqual(geoShapeGeometryCollectionDto.Coordinates.Geometries.Count, result.Coordinates.Geometries.Count); } }
public void CreateGeoShapeGeometryCollectionMapping() { var geoShapeGeometryCollectionDto = new GeoShapeGeometryCollectionDto { Coordinates = new GeoShapeGeometryCollection { Geometries = new List<object> { new GeoShapeMultiLineString { 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) } } }, new GeoShapePoint { Coordinates = new GeoPoint(45, 45) }, new GeoShapeLineString { Coordinates = new List<GeoPoint> { new GeoPoint(45, 45), new GeoPoint(46, 45) } } } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate<GeoShapeGeometryCollectionDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists<GeoShapeGeometryCollectionDto>()); context.AddUpdateDocument(geoShapeGeometryCollectionDto, geoShapeGeometryCollectionDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count<GeoShapeGeometryCollectionDto>()); var result = context.SearchById<GeoShapeGeometryCollectionDto>(1); Assert.AreEqual(geoShapeGeometryCollectionDto.Coordinates.Geometries.Count, result.Coordinates.Geometries.Count); } }