org.elasticsearch.action.get
Class GetRequest

java.lang.Object
  extended by org.elasticsearch.action.support.single.SingleOperationRequest
      extended by org.elasticsearch.action.get.GetRequest
All Implemented Interfaces:
ActionRequest, Streamable

public class GetRequest
extends SingleOperationRequest

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

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

See Also:
GetResponse, Requests.getRequest(String), Client.get(GetRequest)

Field Summary
 
Fields inherited from class org.elasticsearch.action.support.single.SingleOperationRequest
id, index, type
 
Constructor Summary
GetRequest(java.lang.String index)
          Constructs a new get request against the specified index.
GetRequest(java.lang.String index, java.lang.String type, java.lang.String id)
          Constructs a new get request against the specified index with the type and id.
 
Method Summary
 java.lang.String[] fields()
          Explicitly specify the fields that will be returned.
 GetRequest fields(java.lang.String... fields)
          Explicitly specify the fields that will be returned.
 GetRequest id(java.lang.String id)
          Sets the id of the document to fetch.
 GetRequest listenerThreaded(boolean threadedListener)
          Should the listener be called on a separate thread if needed.
 GetRequest operationThreaded(boolean threadedOperation)
          Controls if the operation will be executed on a separate thread when executed locally.
 void readFrom(StreamInput in)
           
 java.lang.String toString()
           
 GetRequest type(java.lang.String type)
          Sets the type of the document to fetch.
 void writeTo(StreamOutput out)
           
 
Methods inherited from class org.elasticsearch.action.support.single.SingleOperationRequest
id, index, listenerThreaded, operationThreaded, type, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GetRequest

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


GetRequest

public GetRequest(java.lang.String index,
                  java.lang.String type,
                  java.lang.String id)
Constructs a new get 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

type

@Required
public GetRequest type(java.lang.String type)
Sets the type of the document to fetch.


id

@Required
public GetRequest id(java.lang.String id)
Sets the id of the document to fetch.


fields

public GetRequest fields(java.lang.String... fields)
Explicitly specify the fields that will be returned. By default, the _source field will be returned.


fields

public java.lang.String[] fields()
Explicitly specify the fields that will be returned. By default, the _source field will be returned.


listenerThreaded

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

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

operationThreaded

public GetRequest operationThreaded(boolean threadedOperation)
Controls if the operation will be executed on a separate thread when executed locally.

Overrides:
operationThreaded in class SingleOperationRequest

readFrom

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

writeTo

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

toString

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