public void CanDeserializeEmptyRootMapping() { var rootMapping = new RootObjectMapping() { }; var json = TestElasticClient.Serialize(rootMapping); var mapping = TestElasticClient.Deserialize <RootObjectMapping>(json); TestElasticClient.Serialize(mapping).JsonEquals(json); }
public void CanDeserializeRootMapping() { var rootMapping = new RootObjectMapping() { AllFieldMapping = new AllFieldMapping() { Enabled = true, IndexAnalyzer = "index_analyzer" }, SourceFieldMappingDescriptor = new SourceFieldMapping() { Compress = false, Excludes = new[] { "excluded" } }, RoutingFieldMapping = new RoutingFieldMapping() { Path = "routing_path" }, SizeFieldMapping = new SizeFieldMapping() { Enabled = true, }, TtlFieldMappingDescriptor = new TtlFieldMapping() { Enabled = true, }, IdFieldMappingDescriptor = new IdFieldMapping() { Index = "not_analyzed", Store = false, Path = "id_field", }, TimestampFieldMapping = new TimestampFieldMapping() { Enabled = true, Format = "YYY-MM-dd", Path = "the_timestamp", }, IndexFieldMapping = new IndexFieldMapping() { Enabled = true, }, AnalyzerFieldMapping = new AnalyzerFieldMapping() { Path = "index_path", }, BoostFieldMapping = new BoostFieldMapping() { Name = "boost", NullValue = 2.0, }, Parent = new ParentTypeMapping() { Type = "type" }, TypeFieldMappingDescriptor = new TypeFieldMapping() { Index = NonStringIndexOption.NotAnalyzed, Store = false, } }; var json = TestElasticClient.Serialize(rootMapping); var mapping = TestElasticClient.Deserialize <RootObjectMapping>(json); TestElasticClient.Serialize(mapping).JsonEquals(json); }