public void CreateGeoShapeEnvelopeMapping() { var geoShapeEnvelopeDto = new GeoShapeEnvelopeDto { Coordinates = new GeoShapeEnvelope { Coordinates = new List <GeoPoint> { // [ [-45.0, 45.0], [45.0, -45.0] ] new GeoPoint(-45, 45), new GeoPoint(45, -45) } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate <GeoShapeEnvelopeDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists <GeoShapeEnvelopeDto>()); context.AddUpdateDocument(geoShapeEnvelopeDto, geoShapeEnvelopeDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count <GeoShapeEnvelopeDto>()); var result = context.SearchById <GeoShapeEnvelopeDto>(1); Assert.AreEqual(geoShapeEnvelopeDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }
public void CreateGeoShapeEnvelopeMapping() { var geoShapeEnvelopeDto = new GeoShapeEnvelopeDto { Coordinates = new GeoShapeEnvelope { Coordinates = new List<GeoPoint> { // [ [-45.0, 45.0], [45.0, -45.0] ] new GeoPoint(-45, 45), new GeoPoint(45, -45) } }, Id = "1", Name = "test", }; using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver))) { context.TraceProvider = new ConsoleTraceProvider(); context.IndexCreate<GeoShapeEnvelopeDto>(); Thread.Sleep(1500); Assert.IsNotNull(context.IndexExists<GeoShapeEnvelopeDto>()); context.AddUpdateDocument(geoShapeEnvelopeDto, geoShapeEnvelopeDto.Id); context.SaveChanges(); Thread.Sleep(1500); Assert.AreEqual(1, context.Count<GeoShapeEnvelopeDto>()); var result = context.SearchById<GeoShapeEnvelopeDto>(1); Assert.AreEqual(geoShapeEnvelopeDto.Coordinates.Coordinates.Count, result.Coordinates.Coordinates.Count); } }