31
31
import org .elasticsearch .common .settings .Settings ;
32
32
import org .elasticsearch .common .xcontent .DeprecationHandler ;
33
33
import org .elasticsearch .common .xcontent .NamedXContentRegistry ;
34
- import org .elasticsearch .common .xcontent .ToXContent ;
34
+ import org .elasticsearch .common .xcontent .ToXContentFragment ;
35
35
import org .elasticsearch .common .xcontent .XContentBuilder ;
36
36
import org .elasticsearch .common .xcontent .XContentFactory ;
37
37
import org .elasticsearch .common .xcontent .XContentHelper ;
56
56
/**
57
57
* A request to create an index template.
58
58
*/
59
- public class PutIndexTemplateRequest extends MasterNodeRequest <PutIndexTemplateRequest > implements IndicesRequest , ToXContent {
59
+ public class PutIndexTemplateRequest extends MasterNodeRequest <PutIndexTemplateRequest > implements IndicesRequest , ToXContentFragment {
60
60
61
61
private String name ;
62
62
@@ -191,7 +191,7 @@ public PutIndexTemplateRequest settings(Map<String, Object> source) {
191
191
public Settings settings () {
192
192
return this .settings ;
193
193
}
194
-
194
+
195
195
/**
196
196
* Adds mapping that will be added when the index gets created.
197
197
*
@@ -201,7 +201,7 @@ public Settings settings() {
201
201
public PutIndexTemplateRequest mapping (String source , XContentType xContentType ) {
202
202
internalMapping (XContentHelper .convertToMap (new BytesArray (source ), true , xContentType ).v2 ());
203
203
return this ;
204
- }
204
+ }
205
205
206
206
/**
207
207
* The cause for this index template creation.
@@ -221,11 +221,11 @@ public String cause() {
221
221
* @param source The mapping source
222
222
*/
223
223
public PutIndexTemplateRequest mapping (XContentBuilder source ) {
224
- internalMapping (XContentHelper .convertToMap (BytesReference .bytes (source ),
224
+ internalMapping (XContentHelper .convertToMap (BytesReference .bytes (source ),
225
225
true , source .contentType ()).v2 ());
226
- return this ;
227
- }
228
-
226
+ return this ;
227
+ }
228
+
229
229
/**
230
230
* Adds mapping that will be added when the index gets created.
231
231
*
@@ -235,16 +235,16 @@ public PutIndexTemplateRequest mapping(XContentBuilder source) {
235
235
public PutIndexTemplateRequest mapping (BytesReference source , XContentType xContentType ) {
236
236
internalMapping (XContentHelper .convertToMap (source , true , xContentType ).v2 ());
237
237
return this ;
238
- }
239
-
238
+ }
239
+
240
240
/**
241
241
* Adds mapping that will be added when the index gets created.
242
242
*
243
243
* @param source The mapping source
244
244
*/
245
245
public PutIndexTemplateRequest mapping (Map <String , Object > source ) {
246
246
return internalMapping (source );
247
- }
247
+ }
248
248
249
249
private PutIndexTemplateRequest internalMapping (Map <String , Object > source ) {
250
250
try {
@@ -257,12 +257,12 @@ private PutIndexTemplateRequest internalMapping(Map<String, Object> source) {
257
257
return this ;
258
258
} catch (IOException e ) {
259
259
throw new UncheckedIOException ("failed to convert source to json" , e );
260
- }
260
+ }
261
261
} catch (IOException e ) {
262
262
throw new ElasticsearchGenerationException ("Failed to generate [" + source + "]" , e );
263
263
}
264
- }
265
-
264
+ }
265
+
266
266
public BytesReference mappings () {
267
267
return this .mappings ;
268
268
}
@@ -349,8 +349,8 @@ public PutIndexTemplateRequest source(byte[] source, int offset, int length, XCo
349
349
*/
350
350
public PutIndexTemplateRequest source (BytesReference source , XContentType xContentType ) {
351
351
return source (XContentHelper .convertToMap (source , true , xContentType ).v2 ());
352
- }
353
-
352
+ }
353
+
354
354
355
355
public Set <Alias > aliases () {
356
356
return this .aliases ;
@@ -441,7 +441,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
441
441
builder .copyCurrentStructure (parser );
442
442
}
443
443
}
444
-
444
+
445
445
builder .startObject ("aliases" );
446
446
for (Alias alias : aliases ) {
447
447
alias .toXContent (builder , params );
0 commit comments