diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java index a0bd4ca2b34..2c61376dd9a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java @@ -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) */ diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java index 5880dca60c2..0f4c7a9cec0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/action/admin/indices/create/CreateIndexRequestBuilder.java @@ -55,6 +55,14 @@ public class CreateIndexRequestBuilder extends BaseIndicesRequestBuilder