summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/action/admin/indices/settings
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/action/admin/indices/settings')
-rw-r--r--core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java16
-rw-r--r--core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java15
2 files changed, 26 insertions, 5 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);
}
diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java
index 36dfbf3b2d..a9cecbfc5a 100644
--- a/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java
+++ b/core/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java
@@ -23,6 +23,7 @@ import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentType;
import java.util.Map;
@@ -70,15 +71,25 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
}
/**
- * 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 #setSettings(String, XContentType)} to avoid content type detection
*/
+ @Deprecated
public UpdateSettingsRequestBuilder setSettings(String source) {
request.settings(source);
return this;
}
/**
- * Sets the settings to be updated (either json/yaml/properties format)
+ * Sets the settings to be updated (either json or yaml format)
+ */
+ public UpdateSettingsRequestBuilder setSettings(String source, XContentType xContentType) {
+ request.settings(source, xContentType);
+ return this;
+ }
+
+ /**
+ * Sets the settings to be updated
*/
public UpdateSettingsRequestBuilder setSettings(Map<String, Object> source) {
request.settings(source);