diff options
Diffstat (limited to 'core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java')
-rw-r--r-- | core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java index e5f5bdb7fb..bd0110e644 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsRequest.java @@ -83,13 +83,23 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd /** * Sets the source containing the transient settings to be updated. They will not survive a full cluster restart + * @deprecated use {@link #transientSettings(String, XContentType)} to avoid content type detection */ + @Deprecated public ClusterUpdateSettingsRequest transientSettings(String source) { this.transientSettings = Settings.builder().loadFromSource(source).build(); return this; } /** + * Sets the source containing the transient settings to be updated. They will not survive a full cluster restart + */ + public ClusterUpdateSettingsRequest transientSettings(String source, XContentType xContentType) { + this.transientSettings = Settings.builder().loadFromSource(source, xContentType).build(); + return this; + } + + /** * Sets the transient settings to be updated. They will not survive a full cluster restart */ @SuppressWarnings("unchecked") @@ -97,7 +107,7 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd try { XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); builder.map(source); - transientSettings(builder.string()); + transientSettings(builder.string(), builder.contentType()); } catch (IOException e) { throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e); } @@ -122,13 +132,23 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd /** * Sets the source containing the persistent settings to be updated. They will get applied cross restarts + * @deprecated use {@link #persistentSettings(String, XContentType)} to avoid content type detection */ + @Deprecated public ClusterUpdateSettingsRequest persistentSettings(String source) { this.persistentSettings = Settings.builder().loadFromSource(source).build(); return this; } /** + * Sets the source containing the persistent settings to be updated. They will get applied cross restarts + */ + public ClusterUpdateSettingsRequest persistentSettings(String source, XContentType xContentType) { + this.persistentSettings = Settings.builder().loadFromSource(source, xContentType).build(); + return this; + } + + /** * Sets the persistent settings to be updated. They will get applied cross restarts */ @SuppressWarnings("unchecked") @@ -136,7 +156,7 @@ public class ClusterUpdateSettingsRequest extends AcknowledgedRequest<ClusterUpd try { XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); builder.map(source); - persistentSettings(builder.string()); + persistentSettings(builder.string(), builder.contentType()); } catch (IOException e) { throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e); } |