summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java')
-rw-r--r--core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java
index e912c6ec73..80f3fb1a07 100644
--- a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java
+++ b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java
@@ -121,14 +121,24 @@ public class UpdateSettingsRequest extends AcknowledgedRequest<UpdateSettingsReq
}
/**
- * Sets the settings to be updated (either json/yaml/properties format)
+ * Sets the settings to be updated (either json or yaml format)
+ * @deprecated use {@link #settings(String, XContentType)} to avoid content type detection
*/
+ @Deprecated
public UpdateSettingsRequest settings(String source) {
this.settings = Settings.builder().loadFromSource(source).build();
return this;
}
/**
+ * Sets the settings to be updated (either json or yaml format)
+ */
+ public UpdateSettingsRequest settings(String source, XContentType xContentType) {
+ this.settings = Settings.builder().loadFromSource(source, xContentType).build();
+ return this;
+ }
+
+ /**
* Returns <code>true</code> iff the settings update should only add but not update settings. If the setting already exists
* it should not be overwritten by this update. The default is <code>false</code>
*/
@@ -146,14 +156,14 @@ public class UpdateSettingsRequest extends AcknowledgedRequest<UpdateSettingsReq
}
/**
- * Sets the settings to be updated (either json/yaml/properties format)
+ * Sets the settings to be updated (either json or yaml format)
*/
@SuppressWarnings("unchecked")
public UpdateSettingsRequest settings(Map source) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.map(source);
- settings(builder.string());
+ settings(builder.string(), builder.contentType());
} catch (IOException e) {
throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e);
}