Package org.elasticsearch.client
Class Request
- java.lang.Object
-
- org.elasticsearch.client.Request
-
public final class Request extends Object
HTTP Request to Elasticsearch.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(String name, String value)Add a query string parameter.voidaddParameters(Map<String,String> paramSource)booleanequals(Object obj)StringgetEndpoint()The path of the request (without scheme, host, port, or prefix).HttpEntitygetEntity()The body of the request.StringgetMethod()The HTTP method.RequestOptionsgetOptions()Get the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.Map<String,String>getParameters()Query string parameters.inthashCode()voidsetEntity(HttpEntity entity)Set the body of the request.voidsetJsonEntity(String entity)Set the body of the request to a string.voidsetOptions(RequestOptions options)Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.voidsetOptions(RequestOptions.Builder options)Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.StringtoString()
-
-
-
Method Detail
-
getMethod
public String getMethod()
The HTTP method.
-
getEndpoint
public String getEndpoint()
The path of the request (without scheme, host, port, or prefix).
-
addParameter
public void addParameter(String name, String value)
Add a query string parameter.- Parameters:
name- the name of the url parameter. Must not be null.value- the value of the url url parameter. Ifnullthen the parameter is sent asnamerather thanname=value- Throws:
IllegalArgumentException- if a parameter with that name has already been set
-
getParameters
public Map<String,String> getParameters()
Query string parameters. The returned map is an unmodifiable view of the map in the request so calls toaddParameter(String, String)will change it.
-
setEntity
public void setEntity(HttpEntity entity)
Set the body of the request. If not set or set tonullthen no body is sent with the request.
-
setJsonEntity
public void setJsonEntity(String entity)
Set the body of the request to a string. If not set or set tonullthen no body is sent with the request. TheContent-Typewill be sent asapplication/json. If you need a different content type then usesetEntity(HttpEntity).
-
getEntity
public HttpEntity getEntity()
The body of the request. Ifnullthen no body is sent with the request.
-
setOptions
public void setOptions(RequestOptions options)
Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
-
setOptions
public void setOptions(RequestOptions.Builder options)
Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
-
getOptions
public RequestOptions getOptions()
Get the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
-
-