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(java.lang.String index)
          Constructs a new delete request against the specified index.
DeleteRequest(java.lang.String index, java.lang.String type, java.lang.String id)
          Constructs a new delete request against the specified index with the type and id.
 
Method Summary
 DeleteRequest id(java.lang.String id)
          Sets the id of the document to delete.
 DeleteRequest index(java.lang.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.
 void readFrom(StreamInput in)
           
 DeleteRequest timeout(TimeValue timeout)
          A timeout to wait if the index operation can't be performed immediately.
 java.lang.String toString()
           
 DeleteRequest type(java.lang.String type)
          Sets the type of the document to delete.
 ActionRequestValidationException validate()
           
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.replication.ShardReplicationOperationRequest
index, listenerThreaded, operationThreaded, timeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeleteRequest

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


DeleteRequest

public DeleteRequest(java.lang.String index,
                     java.lang.String type,
                     java.lang.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
Method Detail

validate

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

index

public DeleteRequest index(java.lang.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

type

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


id

@Required
public DeleteRequest id(java.lang.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.


readFrom

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

writeTo

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object