@@ -58,12 +58,12 @@ protected Collection<Class<? extends Plugin>> getPlugins() {
58
58
}
59
59
60
60
public void testDefaults () throws Exception {
61
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
61
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
62
62
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
63
63
.field ("scaling_factor" , 10.0 ).endObject ().endObject ()
64
64
.endObject ().endObject ());
65
65
66
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
66
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
67
67
68
68
assertEquals (mapping , mapper .mappingSource ().toString ());
69
69
@@ -108,12 +108,12 @@ public void testIllegalScalingFactor() throws IOException {
108
108
}
109
109
110
110
public void testNotIndexed () throws Exception {
111
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
111
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
112
112
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
113
113
.field ("index" , false ).field ("scaling_factor" , 10.0 ).endObject ().endObject ()
114
114
.endObject ().endObject ());
115
115
116
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
116
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
117
117
118
118
assertEquals (mapping , mapper .mappingSource ().toString ());
119
119
@@ -132,12 +132,12 @@ public void testNotIndexed() throws Exception {
132
132
}
133
133
134
134
public void testNoDocValues () throws Exception {
135
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
135
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
136
136
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
137
137
.field ("doc_values" , false ).field ("scaling_factor" , 10.0 ).endObject ().endObject ()
138
138
.endObject ().endObject ());
139
139
140
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
140
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
141
141
142
142
assertEquals (mapping , mapper .mappingSource ().toString ());
143
143
@@ -156,12 +156,12 @@ public void testNoDocValues() throws Exception {
156
156
}
157
157
158
158
public void testStore () throws Exception {
159
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
159
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
160
160
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
161
161
.field ("store" , true ).field ("scaling_factor" , 10.0 ).endObject ().endObject ()
162
162
.endObject ().endObject ());
163
163
164
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
164
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
165
165
166
166
assertEquals (mapping , mapper .mappingSource ().toString ());
167
167
@@ -185,12 +185,12 @@ public void testStore() throws Exception {
185
185
}
186
186
187
187
public void testCoerce () throws Exception {
188
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
188
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
189
189
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
190
190
.field ("scaling_factor" , 10.0 ).endObject ().endObject ()
191
191
.endObject ().endObject ());
192
192
193
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
193
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
194
194
195
195
assertEquals (mapping , mapper .mappingSource ().toString ());
196
196
@@ -209,12 +209,12 @@ public void testCoerce() throws Exception {
209
209
IndexableField dvField = fields [1 ];
210
210
assertEquals (DocValuesType .SORTED_NUMERIC , dvField .fieldType ().docValuesType ());
211
211
212
- mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
212
+ mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
213
213
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
214
214
.field ("scaling_factor" , 10.0 ).field ("coerce" , false ).endObject ().endObject ()
215
215
.endObject ().endObject ());
216
216
217
- DocumentMapper mapper2 = parser .parse ("_doc " , new CompressedXContent (mapping ));
217
+ DocumentMapper mapper2 = parser .parse ("type " , new CompressedXContent (mapping ));
218
218
219
219
assertEquals (mapping , mapper2 .mappingSource ().toString ());
220
220
@@ -238,12 +238,12 @@ public void testIgnoreMalformed() throws Exception {
238
238
}
239
239
240
240
private void doTestIgnoreMalformed (String value , String exceptionMessageContains ) throws Exception {
241
- String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
241
+ String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
242
242
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
243
243
.field ("scaling_factor" , 10.0 ).endObject ().endObject ()
244
244
.endObject ().endObject ());
245
245
246
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
246
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
247
247
248
248
assertEquals (mapping , mapper .mappingSource ().toString ());
249
249
@@ -256,12 +256,12 @@ private void doTestIgnoreMalformed(String value, String exceptionMessageContains
256
256
MapperParsingException e = expectThrows (MapperParsingException .class , runnable );
257
257
assertThat (e .getCause ().getMessage (), containsString (exceptionMessageContains ));
258
258
259
- mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("_doc " )
259
+ mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ().startObject ("type " )
260
260
.startObject ("properties" ).startObject ("field" ).field ("type" , "scaled_float" )
261
261
.field ("scaling_factor" , 10.0 ).field ("ignore_malformed" , true ).endObject ().endObject ()
262
262
.endObject ().endObject ());
263
263
264
- DocumentMapper mapper2 = parser .parse ("_doc " , new CompressedXContent (mapping ));
264
+ DocumentMapper mapper2 = parser .parse ("type " , new CompressedXContent (mapping ));
265
265
266
266
ParsedDocument doc = mapper2 .parse (new SourceToParse ("test" , "1" , BytesReference
267
267
.bytes (XContentFactory .jsonBuilder ()
@@ -276,7 +276,7 @@ private void doTestIgnoreMalformed(String value, String exceptionMessageContains
276
276
277
277
public void testNullValue () throws IOException {
278
278
String mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ()
279
- .startObject ("_doc " )
279
+ .startObject ("type " )
280
280
.startObject ("properties" )
281
281
.startObject ("field" )
282
282
.field ("type" , "scaled_float" )
@@ -285,7 +285,7 @@ public void testNullValue() throws IOException {
285
285
.endObject ()
286
286
.endObject ().endObject ());
287
287
288
- DocumentMapper mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
288
+ DocumentMapper mapper = parser .parse ("type " , new CompressedXContent (mapping ));
289
289
assertEquals (mapping , mapper .mappingSource ().toString ());
290
290
291
291
ParsedDocument doc = mapper .parse (new SourceToParse ("test" , "1" , BytesReference
@@ -297,7 +297,7 @@ public void testNullValue() throws IOException {
297
297
assertArrayEquals (new IndexableField [0 ], doc .rootDoc ().getFields ("field" ));
298
298
299
299
mapping = Strings .toString (XContentFactory .jsonBuilder ().startObject ()
300
- .startObject ("_doc " )
300
+ .startObject ("type " )
301
301
.startObject ("properties" )
302
302
.startObject ("field" )
303
303
.field ("type" , "scaled_float" )
@@ -307,7 +307,7 @@ public void testNullValue() throws IOException {
307
307
.endObject ()
308
308
.endObject ().endObject ());
309
309
310
- mapper = parser .parse ("_doc " , new CompressedXContent (mapping ));
310
+ mapper = parser .parse ("type " , new CompressedXContent (mapping ));
311
311
assertEquals (mapping , mapper .mappingSource ().toString ());
312
312
313
313
doc = mapper .parse (new SourceToParse ("test" , "1" , BytesReference
0 commit comments