org.elasticsearch.action.delete
Class DeleteRequest

java.lang.Object
  extended by org.elasticsearch.action.support.replication.ShardReplicationOperationRequest
      extended by org.elasticsearch.action.delete.DeleteRequest
All Implemented Interfaces:
ActionRequest, Streamable

public class DeleteRequest
extends ShardReplicationOperationRequest

A request to delete a document from an index based on its type and id. Best created using Requests.deleteRequest(String).

The operation requires the ShardReplicationOperationRequest.index(), type(String) and id(String) to be set.

See Also:
DeleteResponse, Client.delete(DeleteRequest), Requests.deleteRequest(String)

Field Summary
 
Fields inherited from class org.elasticsearch.action.support.replication.ShardReplicationOperationRequest
DEFAULT_TIMEOUT, index, timeout
 
Constructor Summary
DeleteRequest()
           
DeleteRequest(String index)
          Constructs a new delete request against the specified index.
DeleteRequest(String index, String type, String id)
          Constructs a new delete request against the specified index with the type and id.
 
Method Summary
 DeleteRequest consistencyLevel(WriteConsistencyLevel consistencyLevel)
          Sets the consistency level of write.
 String id()
          The id of the document to delete.
 DeleteRequest id(String id)
          Sets the id of the document to delete.
 DeleteRequest index(String index)
          Sets the index the delete will happen on.
 DeleteRequest listenerThreaded(boolean threadedListener)
          Should the listener be called on a separate thread if needed.
 DeleteRequest operationThreaded(boolean threadedOperation)
          Controls if the operation will be executed on a separate thread when executed locally.
 DeleteRequest parent(String parent)
          Sets the parent id of this document.
 void readFrom(StreamInput in)
           
 boolean refresh()
           
 DeleteRequest refresh(boolean refresh)
          Should a refresh be executed post this index operation causing the operation to be searchable.
 DeleteRequest replicationType(ReplicationType replicationType)
          Set the replication type for this operation.
 String routing()
          Controls the shard routing of the delete request.
 DeleteRequest routing(String routing)
          Controls the shard routing of the request.
 DeleteRequest timeout(TimeValue timeout)
          A timeout to wait if the index operation can't be performed immediately.
 String toString()
           
 String type()
          The type of the document to delete.
 DeleteRequest type(String type)
          Sets the type of the document to delete.
 ActionRequestValidationException validate()
           
 long version()
           
 DeleteRequest version(long version)
          Sets the version, which will cause the delete operation to only be performed if a matching version exists and no changes happened on the doc since then.
 VersionType versionType()
           
 DeleteRequest versionType(VersionType versionType)
           
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.replication.ShardReplicationOperationRequest
beforeLocalFork, consistencyLevel, index, listenerThreaded, operationThreaded, replicationType, timeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteRequest

public DeleteRequest(String index)
Constructs a new delete request against the specified index. The type(String) and id(String) must be set.


DeleteRequest

public DeleteRequest(String index,
                     String type,
                     String id)
Constructs a new delete request against the specified index with the type and id.

Parameters:
index - The index to get the document from
type - The type of the document
id - The id of the document

DeleteRequest

public DeleteRequest()
Method Detail

validate

public ActionRequestValidationException validate()
Specified by:
validate in interface ActionRequest
Overrides:
validate in class ShardReplicationOperationRequest

index

public DeleteRequest index(String index)
Sets the index the delete will happen on.

Overrides:
index in class ShardReplicationOperationRequest

listenerThreaded

public DeleteRequest listenerThreaded(boolean threadedListener)
Should the listener be called on a separate thread if needed.

Specified by:
listenerThreaded in interface ActionRequest
Overrides:
listenerThreaded in class ShardReplicationOperationRequest

operationThreaded

public DeleteRequest operationThreaded(boolean threadedOperation)
Controls if the operation will be executed on a separate thread when executed locally. Defaults to true when running in embedded mode.

Overrides:
operationThreaded in class ShardReplicationOperationRequest

replicationType

public DeleteRequest replicationType(ReplicationType replicationType)
Set the replication type for this operation.

Overrides:
replicationType in class ShardReplicationOperationRequest

consistencyLevel

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

Overrides:
consistencyLevel in class ShardReplicationOperationRequest

type

public String type()
The type of the document to delete.


type

@Required
public DeleteRequest type(String type)
Sets the type of the document to delete.


id

public String id()
The id of the document to delete.


id

@Required
public DeleteRequest id(String id)
Sets the id of the document to delete.


timeout

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


parent

public DeleteRequest parent(String parent)
Sets the parent id of this document. Will simply set the routing to this value, as it is only used for routing with delete requests.


routing

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


routing

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


refresh

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


refresh

public boolean refresh()

version

public DeleteRequest version(long version)
Sets the version, which will cause the delete operation to only be performed if a matching version exists and no changes happened on the doc since then.


version

public long version()

versionType

public DeleteRequest versionType(VersionType versionType)

versionType

public VersionType versionType()

readFrom

public void readFrom(StreamInput in)
              throws IOException
Specified by:
readFrom in interface Streamable
Overrides:
readFrom in class ShardReplicationOperationRequest
Throws:
IOException

writeTo

public void writeTo(StreamOutput out)
             throws IOException
Specified by:
writeTo in interface Streamable
Overrides:
writeTo in class ShardReplicationOperationRequest
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012. All Rights Reserved.