summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java')
-rw-r--r--core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java61
1 files changed, 59 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java
index c1db96ae7c..e7ca25e511 100644
--- a/core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java
+++ b/core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java
@@ -24,6 +24,7 @@ import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentType;
import java.util.Collections;
import java.util.List;
@@ -100,15 +101,25 @@ public class PutIndexTemplateRequestBuilder
}
/**
- * The settings to crete the index template with (either json/yaml/properties format)
+ * The settings to crete the index template with (either json or yaml format)
+ * @deprecated use {@link #setSettings(String, XContentType)}
*/
+ @Deprecated
public PutIndexTemplateRequestBuilder setSettings(String source) {
request.settings(source);
return this;
}
/**
- * The settings to crete the index template with (either json/yaml/properties format)
+ * The settings to crete the index template with (either json or yaml format)
+ */
+ public PutIndexTemplateRequestBuilder setSettings(String source, XContentType xContentType) {
+ request.settings(source, xContentType);
+ return this;
+ }
+
+ /**
+ * The settings to crete the index template with (either json or yaml format)
*/
public PutIndexTemplateRequestBuilder setSettings(Map<String, Object> source) {
request.settings(source);
@@ -120,13 +131,27 @@ public class PutIndexTemplateRequestBuilder
*
* @param type The mapping type
* @param source The mapping source
+ * @deprecated use {@link #addMapping(String, String, XContentType)}
*/
+ @Deprecated
public PutIndexTemplateRequestBuilder addMapping(String type, String source) {
request.mapping(type, source);
return this;
}
/**
+ * Adds mapping that will be added when the index template gets created.
+ *
+ * @param type The mapping type
+ * @param source The mapping source
+ * @param xContentType The type/format of the source
+ */
+ public PutIndexTemplateRequestBuilder addMapping(String type, String source, XContentType xContentType) {
+ request.mapping(type, source, xContentType);
+ return this;
+ }
+
+ /**
* A specialized simplified mapping source method, takes the form of simple properties definition:
* ("field1", "type=string,store=true").
*/
@@ -226,7 +251,9 @@ public class PutIndexTemplateRequestBuilder
/**
* The template source definition.
+ * @deprecated use {@link #setSource(BytesReference, XContentType)}
*/
+ @Deprecated
public PutIndexTemplateRequestBuilder setSource(String templateSource) {
request.source(templateSource);
return this;
@@ -235,6 +262,16 @@ public class PutIndexTemplateRequestBuilder
/**
* The template source definition.
*/
+ public PutIndexTemplateRequestBuilder setSource(BytesReference templateSource, XContentType xContentType) {
+ request.source(templateSource, xContentType);
+ return this;
+ }
+
+ /**
+ * The template source definition.
+ * @deprecated use {@link #setSource(BytesReference, XContentType)}
+ */
+ @Deprecated
public PutIndexTemplateRequestBuilder setSource(BytesReference templateSource) {
request.source(templateSource);
return this;
@@ -242,7 +279,9 @@ public class PutIndexTemplateRequestBuilder
/**
* The template source definition.
+ * @deprecated use {@link #setSource(byte[], XContentType)}
*/
+ @Deprecated
public PutIndexTemplateRequestBuilder setSource(byte[] templateSource) {
request.source(templateSource);
return this;
@@ -251,8 +290,26 @@ public class PutIndexTemplateRequestBuilder
/**
* The template source definition.
*/
+ public PutIndexTemplateRequestBuilder setSource(byte[] templateSource, XContentType xContentType) {
+ request.source(templateSource, xContentType);
+ return this;
+ }
+
+ /**
+ * The template source definition.
+ * @deprecated use {@link #setSource(byte[], int, int, XContentType)}
+ */
+ @Deprecated
public PutIndexTemplateRequestBuilder setSource(byte[] templateSource, int offset, int length) {
request.source(templateSource, offset, length);
return this;
}
+
+ /**
+ * The template source definition.
+ */
+ public PutIndexTemplateRequestBuilder setSource(byte[] templateSource, int offset, int length, XContentType xContentType) {
+ request.source(templateSource, offset, length, xContentType);
+ return this;
+ }
}