@@ -14,14 +14,16 @@ pub trait MappingTrait {
14
14
15
15
pub struct MappingBuilder {
16
16
properties : MappingProperties ,
17
- setting : Option < Value > ,
17
+ settings : Option < Value > ,
18
+ aliases : Option < Value > ,
18
19
}
19
20
20
21
impl MappingBuilder {
21
22
pub fn new ( ) -> MappingBuilder {
22
23
MappingBuilder {
23
24
properties : MappingProperties :: new ( ) ,
24
- setting : None ,
25
+ settings : None ,
26
+ aliases : None ,
25
27
}
26
28
}
27
29
pub fn add_property < T > ( & mut self , key : & str , value : T ) -> & mut MappingBuilder
@@ -34,14 +36,20 @@ impl MappingBuilder {
34
36
pub fn set_properties ( & mut self , properties : MappingProperties ) {
35
37
self . properties = properties;
36
38
}
37
- pub fn set_setting ( & mut self , properties : Value ) {
38
- self . setting = Some ( properties) ;
39
+ pub fn set_settings ( & mut self , settings : Value ) {
40
+ self . settings = Some ( settings) ;
41
+ }
42
+ pub fn set_aliases ( & mut self , aliases : Value ) {
43
+ self . aliases = Some ( aliases) ;
39
44
}
40
45
pub fn build ( self ) -> Value {
41
46
let mut map = UtilMap :: new ( ) ;
42
47
map. append_value ( "mappings" , self . properties . build ( ) ) ;
43
- if let Some ( ref setting) = self . setting {
44
- map. append_value ( "setting" , setting. clone ( ) )
48
+ if let Some ( ref settings) = self . settings {
49
+ map. append_value ( "settings" , settings. clone ( ) )
50
+ }
51
+ if let Some ( ref aliases) = self . aliases {
52
+ map. append_value ( "aliases" , aliases. clone ( ) )
45
53
}
46
54
map. build ( )
47
55
}
0 commit comments