Package org.opensearch.client
Class Request
java.lang.Object
org.opensearch.client.Request
HTTP Request to OpenSearch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(String name, String value) Add a query string parameter.voidaddParameters(Map<String, String> paramSource) Add query parameters using the provided map of key value pairs.booleanThe path of the request (without scheme, host, port, or prefix).org.apache.http.HttpEntityThe body of the request.The HTTP method.Get the portion of an HTTP request to OpenSearch that can be manipulated without changing OpenSearch's behavior.Query string parameters.inthashCode()voidsetEntity(org.apache.http.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 OpenSearch that can be manipulated without changing OpenSearch's behavior.voidsetOptions(RequestOptions.Builder options) Set the portion of an HTTP request to OpenSearch that can be manipulated without changing OpenSearch's behavior.toString()
-
Constructor Details
-
Request
Create the Request.- Parameters:
method- the HTTP methodendpoint- the path of the request (without scheme, host, port, or prefix)
-
-
Method Details
-
getMethod
The HTTP method. -
getEndpoint
The path of the request (without scheme, host, port, or prefix). -
addParameter
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
-
addParameters
Add query parameters using the provided map of key value pairs.- Parameters:
paramSource- a map of key value pairs where the key is the url parameter.- Throws:
IllegalArgumentException- if a parameter with that name has already been set.
-
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(org.apache.http.HttpEntity entity) Set the body of the request. If not set or set tonullthen no body is sent with the request.- Parameters:
entity- theHttpEntityto be set as the body of the request.
-
setJsonEntity
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).- Parameters:
entity- JSON string to be set as the entity body of the request.
-
getEntity
public org.apache.http.HttpEntity getEntity()The body of the request. Ifnullthen no body is sent with the request. -
setOptions
Set the portion of an HTTP request to OpenSearch that can be manipulated without changing OpenSearch's behavior.- Parameters:
options- the options to be set.- Throws:
NullPointerException- ifoptionsis null.
-
setOptions
Set the portion of an HTTP request to OpenSearch that can be manipulated without changing OpenSearch's behavior.- Parameters:
options- the options to be set.- Throws:
NullPointerException- ifoptionsis null.
-
getOptions
Get the portion of an HTTP request to OpenSearch that can be manipulated without changing OpenSearch's behavior. -
toString
-
equals
-
hashCode
public int hashCode()
-