File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/Tests/Nest.Tests.Integration/Mapping Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ public class MapFromAttributeTests : IntegrationTests
1515 class MapFromAttributeObject
1616 {
1717 public string Name { get ; set ; }
18+ public int Number { get ; set ; }
1819 [ ElasticProperty ( Type = FieldType . Nested , IncludeInParent = true ) ]
1920 public List < NestedObject > NestedObjects { get ; set ; }
2021 [ ElasticProperty ( Type = FieldType . Nested ) ]
@@ -45,5 +46,32 @@ public void InlcudeInParent()
4546 nestedObject . IncludeInParent . Should ( ) . BeTrue ( ) ;
4647 nestedObjectDontincludeInParent . IncludeInParent . Should ( ) . NotHaveValue ( ) ;
4748 }
49+
50+ [ Test ]
51+ public void NumberNotAnalyzedShouldBeNotAnalyzed ( )
52+ {
53+ var index = ElasticsearchConfiguration . NewUniqueIndexName ( ) ;
54+ var indicesResponse = this . Client . CreateIndex ( c=> c
55+ . Index ( index )
56+ . AddMapping < MapFromAttributeObject > ( m=> m
57+ . MapFromAttributes ( )
58+ . Properties ( prop=> prop
59+ . Number ( n=> n . Name ( p=> p . Number ) . Index ( NonStringIndexOption . NotAnalyzed ) )
60+ )
61+ )
62+
63+ ) ;
64+
65+ indicesResponse . IsValid . Should ( ) . BeTrue ( ) ;
66+
67+ var typeMapping = this . Client . GetMapping < MapFromAttributeObject > ( i => i . Index ( index ) ) ;
68+ typeMapping . Should ( ) . NotBeNull ( ) ;
69+
70+ var numberMapping = typeMapping . Mapping . Properties [ "number" ] as NumberMapping ;
71+ numberMapping . Should ( ) . NotBeNull ( ) ;
72+ //index == null because not analyzed is default
73+ numberMapping . Index . Should ( ) . NotBe ( NonStringIndexOption . Analyzed ) . And . BeNull ( ) ;
74+ }
75+
4876 }
4977}
You can’t perform that action at this time.
0 commit comments