add xcontent builder settings option (though just calling builder#string() was always possible) to create index

This commit is contained in:
kimchy 2011-06-29 15:12:53 +03:00
parent 0bf1ed964e
commit c31ee7d68d
2 changed files with 20 additions and 0 deletions

View File

@ -136,6 +136,18 @@ public class CreateIndexRequest extends MasterNodeOperationRequest {
return this;
}
/**
* Allows to set the settings using a json builder.
*/
public CreateIndexRequest settings(XContentBuilder builder) {
try {
settings(builder.string());
} catch (IOException e) {
throw new ElasticSearchGenerationException("Failed to generate json settings from builder", e);
}
return this;
}
/**
* The settings to crete the index with (either json/yaml/properties format)
*/

View File

@ -55,6 +55,14 @@ public class CreateIndexRequestBuilder extends BaseIndicesRequestBuilder<CreateI
return this;
}
/**
* Allows to set the settings using a json builder.
*/
public CreateIndexRequestBuilder setSettings(XContentBuilder builder) {
request.settings(builder);
return this;
}
/**
* The settings to crete the index with (either json/yaml/properties format)
*/