org.elasticsearch.action.update
Class UpdateRequestBuilder

java.lang.Object
  extended by org.elasticsearch.action.support.BaseRequestBuilder<UpdateRequest,UpdateResponse>
      extended by org.elasticsearch.action.update.UpdateRequestBuilder
All Implemented Interfaces:
ActionRequestBuilder<UpdateRequest,UpdateResponse>

public class UpdateRequestBuilder
extends BaseRequestBuilder<UpdateRequest,UpdateResponse>


Field Summary
 
Fields inherited from class org.elasticsearch.action.support.BaseRequestBuilder
client, request
 
Constructor Summary
UpdateRequestBuilder(Client client)
           
UpdateRequestBuilder(Client client, String index, String type, String id)
           
 
Method Summary
 UpdateRequestBuilder addScriptParam(String name, Object value)
          Add a script parameter.
protected  void doExecute(ActionListener<UpdateResponse> listener)
           
 UpdateRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
          Sets the consistency level of write.
 UpdateRequestBuilder setDoc(byte[] source)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(byte[] source, int offset, int length)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(IndexRequest indexRequest)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(Map source)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(Map source, XContentType contentType)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(String source)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setDoc(XContentBuilder source)
          Sets the doc to use for updates when a script is not specified.
 UpdateRequestBuilder setFields(String... fields)
          Explicitly specify the fields that will be returned.
 UpdateRequestBuilder setId(String id)
          Sets the id of the indexed document.
 UpdateRequestBuilder setIndex(String index)
          Sets the index the document will exists on.
 UpdateRequestBuilder setParent(String parent)
           
 UpdateRequestBuilder setPercolate(String percolate)
          Causes the updated document to be percolated.
 UpdateRequestBuilder setRefresh(boolean refresh)
          Should a refresh be executed post this update operation causing the operation to be searchable.
 UpdateRequestBuilder setReplicationType(ReplicationType replicationType)
          Sets the replication type.
 UpdateRequestBuilder setRetryOnConflict(int retryOnConflict)
          Sets the number of retries of a version conflict occurs because the document was updated between getting it and updating it.
 UpdateRequestBuilder setRouting(String routing)
          Controls the shard routing of the request.
 UpdateRequestBuilder setScript(String script)
          The script to execute.
 UpdateRequestBuilder setScriptLang(String scriptLang)
          The language of the script to execute.
 UpdateRequestBuilder setScriptParams(Map<String,Object> scriptParams)
          Sets the script parameters to use with the script.
 UpdateRequestBuilder setSource(byte[] source)
           
 UpdateRequestBuilder setSource(byte[] source, int offset, int length)
           
 UpdateRequestBuilder setSource(BytesReference source)
           
 UpdateRequestBuilder setSource(XContentBuilder source)
           
 UpdateRequestBuilder setTimeout(String timeout)
          A timeout to wait if the index operation can't be performed immediately.
 UpdateRequestBuilder setTimeout(TimeValue timeout)
          A timeout to wait if the index operation can't be performed immediately.
 UpdateRequestBuilder setType(String type)
          Sets the type of the indexed document.
 UpdateRequestBuilder setUpsert(byte[] source)
          Sets the doc source of the update request to be used when the document does not exists.
 UpdateRequestBuilder setUpsert(byte[] source, int offset, int length)
          Sets the doc source of the update request to be used when the document does not exists.
 UpdateRequestBuilder setUpsert(IndexRequest indexRequest)
          Sets the index request to be used if the document does not exists.
 UpdateRequestBuilder setUpsert(Map source)
          Sets the doc source of the update request to be used when the document does not exists.
 UpdateRequestBuilder setUpsert(Map source, XContentType contentType)
          Sets the doc source of the update request to be used when the document does not exists.
 UpdateRequestBuilder setUpsert(String source)
          Sets the doc source of the update request to be used when the document does not exists.
 UpdateRequestBuilder setUpsert(XContentBuilder source)
          Sets the doc source of the update request to be used when the document does not exists.
 
Methods inherited from class org.elasticsearch.action.support.BaseRequestBuilder
execute, execute, request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateRequestBuilder

public UpdateRequestBuilder(Client client)

UpdateRequestBuilder

public UpdateRequestBuilder(Client client,
                            String index,
                            String type,
                            String id)
Method Detail

setIndex

public UpdateRequestBuilder setIndex(String index)
Sets the index the document will exists on.


setType

public UpdateRequestBuilder setType(String type)
Sets the type of the indexed document.


setId

public UpdateRequestBuilder setId(String id)
Sets the id of the indexed document.


setRouting

public UpdateRequestBuilder setRouting(String routing)
Controls the shard routing of the request. Using this value to hash the shard and not the id.


setParent

public UpdateRequestBuilder setParent(String parent)

setScript

public UpdateRequestBuilder setScript(String script)
The script to execute. Note, make sure not to send different script each times and instead use script params if possible with the same (automatically compiled) script.


setScriptLang

public UpdateRequestBuilder setScriptLang(String scriptLang)
The language of the script to execute.


setScriptParams

public UpdateRequestBuilder setScriptParams(Map<String,Object> scriptParams)
Sets the script parameters to use with the script.


addScriptParam

public UpdateRequestBuilder addScriptParam(String name,
                                           Object value)
Add a script parameter.


setFields

public UpdateRequestBuilder setFields(String... fields)
Explicitly specify the fields that will be returned. By default, nothing is returned.


setRetryOnConflict

public UpdateRequestBuilder setRetryOnConflict(int retryOnConflict)
Sets the number of retries of a version conflict occurs because the document was updated between getting it and updating it. Defaults to 1.


setTimeout

public UpdateRequestBuilder setTimeout(TimeValue timeout)
A timeout to wait if the index operation can't be performed immediately. Defaults to 1m.


setTimeout

public UpdateRequestBuilder setTimeout(String timeout)
A timeout to wait if the index operation can't be performed immediately. Defaults to 1m.


setRefresh

public UpdateRequestBuilder setRefresh(boolean refresh)
Should a refresh be executed post this update operation causing the operation to be searchable. Note, heavy indexing should not set this to true. Defaults to false.


setReplicationType

public UpdateRequestBuilder setReplicationType(ReplicationType replicationType)
Sets the replication type.


setConsistencyLevel

public UpdateRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level of write. Defaults to WriteConsistencyLevel.DEFAULT


setPercolate

public UpdateRequestBuilder setPercolate(String percolate)
Causes the updated document to be percolated. The parameter is the percolate query to use to reduce the percolated queries that are going to run against this doc. Can be set to * to indicate that all percolate queries should be run.


setDoc

public UpdateRequestBuilder setDoc(IndexRequest indexRequest)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(XContentBuilder source)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(Map source)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(Map source,
                                   XContentType contentType)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(String source)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(byte[] source)
Sets the doc to use for updates when a script is not specified.


setDoc

public UpdateRequestBuilder setDoc(byte[] source,
                                   int offset,
                                   int length)
Sets the doc to use for updates when a script is not specified.


setUpsert

public UpdateRequestBuilder setUpsert(IndexRequest indexRequest)
Sets the index request to be used if the document does not exists. Otherwise, a DocumentMissingException is thrown.


setUpsert

public UpdateRequestBuilder setUpsert(XContentBuilder source)
Sets the doc source of the update request to be used when the document does not exists.


setUpsert

public UpdateRequestBuilder setUpsert(Map source)
Sets the doc source of the update request to be used when the document does not exists.


setUpsert

public UpdateRequestBuilder setUpsert(Map source,
                                      XContentType contentType)
Sets the doc source of the update request to be used when the document does not exists.


setUpsert

public UpdateRequestBuilder setUpsert(String source)
Sets the doc source of the update request to be used when the document does not exists.


setUpsert

public UpdateRequestBuilder setUpsert(byte[] source)
Sets the doc source of the update request to be used when the document does not exists.


setUpsert

public UpdateRequestBuilder setUpsert(byte[] source,
                                      int offset,
                                      int length)
Sets the doc source of the update request to be used when the document does not exists.


setSource

public UpdateRequestBuilder setSource(XContentBuilder source)
                               throws Exception
Throws:
Exception

setSource

public UpdateRequestBuilder setSource(byte[] source)
                               throws Exception
Throws:
Exception

setSource

public UpdateRequestBuilder setSource(byte[] source,
                                      int offset,
                                      int length)
                               throws Exception
Throws:
Exception

setSource

public UpdateRequestBuilder setSource(BytesReference source)
                               throws Exception
Throws:
Exception

doExecute

protected void doExecute(ActionListener<UpdateResponse> listener)
Specified by:
doExecute in class BaseRequestBuilder<UpdateRequest,UpdateResponse>


Copyright © 2009-2012. All Rights Reserved.