@@ -83,33 +83,23 @@ class NotFound < Exception; end
83
83
assert_equal 'boolean' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo ] [ :type ]
84
84
end
85
85
86
- should "define type as string by default" do
86
+ should "define type as 'text' by default" do
87
87
mappings = Elasticsearch ::Model ::Indexing ::Mappings . new :mytype
88
88
89
- mappings . indexes :bar , { }
90
- assert_equal 'string ' , mappings . to_hash [ :mytype ] [ :properties ] [ :bar ] [ :type ]
89
+ mappings . indexes :bar
90
+ assert_equal 'text ' , mappings . to_hash [ :mytype ] [ :properties ] [ :bar ] [ :type ]
91
91
end
92
92
93
93
should "define multiple fields" do
94
94
mappings = Elasticsearch ::Model ::Indexing ::Mappings . new :mytype
95
95
96
- mappings . indexes :foo_1 , type : 'string ' do
97
- indexes :raw , analyzer : 'keyword'
96
+ mappings . indexes :my_field , type : 'text ' do
97
+ indexes :raw , type : 'keyword'
98
98
end
99
99
100
- mappings . indexes :foo_2 , type : 'multi_field' do
101
- indexes :raw , analyzer : 'keyword'
102
- end
103
-
104
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_1 ] [ :type ]
105
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_1 ] [ :fields ] [ :raw ] [ :type ]
106
- assert_equal 'keyword' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_1 ] [ :fields ] [ :raw ] [ :analyzer ]
107
- assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :foo_1 ] [ :properties ]
108
-
109
- assert_equal 'multi_field' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_2 ] [ :type ]
110
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_2 ] [ :fields ] [ :raw ] [ :type ]
111
- assert_equal 'keyword' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_2 ] [ :fields ] [ :raw ] [ :analyzer ]
112
- assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :foo_2 ] [ :properties ]
100
+ assert_equal 'text' , mappings . to_hash [ :mytype ] [ :properties ] [ :my_field ] [ :type ]
101
+ assert_equal 'keyword' , mappings . to_hash [ :mytype ] [ :properties ] [ :my_field ] [ :fields ] [ :raw ] [ :type ]
102
+ assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :my_field ] [ :properties ]
113
103
end
114
104
115
105
should "define embedded properties" do
@@ -134,15 +124,15 @@ class NotFound < Exception; end
134
124
# Object is the default when `type` is missing and there's a block passed
135
125
#
136
126
assert_equal 'object' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo ] [ :type ]
137
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo ] [ :properties ] [ :bar ] [ :type ]
127
+ assert_equal 'text' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo ] [ :properties ] [ :bar ] [ :type ]
138
128
assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :foo ] [ :fields ]
139
129
140
130
assert_equal 'object' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_object ] [ :type ]
141
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_object ] [ :properties ] [ :bar ] [ :type ]
131
+ assert_equal 'text' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_object ] [ :properties ] [ :bar ] [ :type ]
142
132
assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :foo_object ] [ :fields ]
143
133
144
134
assert_equal 'nested' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_nested ] [ :type ]
145
- assert_equal 'string' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_nested ] [ :properties ] [ :bar ] [ :type ]
135
+ assert_equal 'text' , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_nested ] [ :properties ] [ :bar ] [ :type ]
146
136
assert_nil mappings . to_hash [ :mytype ] [ :properties ] [ :foo_nested ] [ :fields ]
147
137
148
138
assert_equal :nested , mappings . to_hash [ :mytype ] [ :properties ] [ :foo_nested_as_symbol ] [ :type ]
0 commit comments