diff options
Diffstat (limited to 'core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java')
-rw-r--r-- | core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java index 50d84a2412..1a4d4077b1 100644 --- a/core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java +++ b/core/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java @@ -223,7 +223,9 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc to use for updates when a script is not specified. + * @deprecated use {@link #setDoc(String, XContentType)} */ + @Deprecated public UpdateRequestBuilder setDoc(String source) { request.doc(source); return this; @@ -232,6 +234,16 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc to use for updates when a script is not specified. */ + public UpdateRequestBuilder setDoc(String source, XContentType xContentType) { + request.doc(source, xContentType); + return this; + } + + /** + * Sets the doc to use for updates when a script is not specified. + * @deprecated use {@link #setDoc(byte[], XContentType)} + */ + @Deprecated public UpdateRequestBuilder setDoc(byte[] source) { request.doc(source); return this; @@ -240,6 +252,16 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc to use for updates when a script is not specified. */ + public UpdateRequestBuilder setDoc(byte[] source, XContentType xContentType) { + request.doc(source, xContentType); + return this; + } + + /** + * Sets the doc to use for updates when a script is not specified. + * @deprecated use {@link #setDoc(byte[], int, int, XContentType)} + */ + @Deprecated public UpdateRequestBuilder setDoc(byte[] source, int offset, int length) { request.doc(source, offset, length); return this; @@ -248,8 +270,8 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequestBuilder setDoc(String field, Object value) { - request.doc(field, value); + public UpdateRequestBuilder setDoc(byte[] source, int offset, int length, XContentType xContentType) { + request.doc(source, offset, length, xContentType); return this; } @@ -263,6 +285,15 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U } /** + * Sets the doc to use for updates when a script is not specified, the doc provided + * is a field and value pairs. + */ + public UpdateRequestBuilder setDoc(XContentType xContentType, Object... source) { + request.doc(xContentType, source); + return this; + } + + /** * Sets the index request to be used if the document does not exists. Otherwise, a {@link org.elasticsearch.index.engine.DocumentMissingException} * is thrown. */ @@ -297,7 +328,9 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc source of the update request to be used when the document does not exists. + * @deprecated use {@link #setUpsert(String, XContentType)} */ + @Deprecated public UpdateRequestBuilder setUpsert(String source) { request.upsert(source); return this; @@ -306,6 +339,16 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc source of the update request to be used when the document does not exists. */ + public UpdateRequestBuilder setUpsert(String source, XContentType xContentType) { + request.upsert(source, xContentType); + return this; + } + + /** + * Sets the doc source of the update request to be used when the document does not exists. + * @deprecated use {@link #setDoc(byte[], XContentType)} + */ + @Deprecated public UpdateRequestBuilder setUpsert(byte[] source) { request.upsert(source); return this; @@ -314,12 +357,30 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U /** * Sets the doc source of the update request to be used when the document does not exists. */ + public UpdateRequestBuilder setUpsert(byte[] source, XContentType xContentType) { + request.upsert(source, xContentType); + return this; + } + + /** + * Sets the doc source of the update request to be used when the document does not exists. + * @deprecated use {@link #setUpsert(byte[], int, int, XContentType)} + */ + @Deprecated public UpdateRequestBuilder setUpsert(byte[] source, int offset, int length) { request.upsert(source, offset, length); return this; } /** + * Sets the doc source of the update request to be used when the document does not exists. + */ + public UpdateRequestBuilder setUpsert(byte[] source, int offset, int length, XContentType xContentType) { + request.upsert(source, offset, length, xContentType); + return this; + } + + /** * Sets the doc source of the update request to be used when the document does not exists. The doc * includes field and value pairs. */ @@ -329,6 +390,15 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U } /** + * Sets the doc source of the update request to be used when the document does not exists. The doc + * includes field and value pairs. + */ + public UpdateRequestBuilder setUpsert(XContentType xContentType, Object... source) { + request.upsert(xContentType, source); + return this; + } + + /** * Sets whether the specified doc parameter should be used as upsert document. */ public UpdateRequestBuilder setDocAsUpsert(boolean shouldUpsertDoc) { |