Class Request


  • public final class Request
    extends java.lang.Object
    HTTP Request to Elasticsearch.
    • Constructor Summary

      Constructors 
      Constructor Description
      Request​(java.lang.String method, java.lang.String endpoint)
      Create the Request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(java.lang.String name, java.lang.String value)
      Add a query string parameter.
      boolean equals​(java.lang.Object obj)  
      java.lang.String getEndpoint()
      The path of the request (without scheme, host, port, or prefix).
      org.apache.http.HttpEntity getEntity()
      The body of the request.
      java.lang.String getMethod()
      The HTTP method.
      RequestOptions getOptions()
      Get the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
      java.util.Map<java.lang.String,​java.lang.String> getParameters()
      Query string parameters.
      int hashCode()  
      void setEntity​(org.apache.http.HttpEntity entity)
      Set the body of the request.
      void setJsonEntity​(java.lang.String entity)
      Set the body of the request to a string.
      void setOptions​(RequestOptions options)
      Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
      void setOptions​(RequestOptions.Builder options)
      Set the portion of an HTTP request to Elasticsearch that can be manipulated without changing Elasticsearch's behavior.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Request

        public Request​(java.lang.String method,
                       java.lang.String endpoint)
        Create the Request.
        Parameters:
        method - the HTTP method
        endpoint - the path of the request (without scheme, host, port, or prefix)
    • Method Detail

      • getMethod

        public java.lang.String getMethod()
        The HTTP method.
      • getEndpoint

        public java.lang.String getEndpoint()
        The path of the request (without scheme, host, port, or prefix).
      • addParameter

        public void addParameter​(java.lang.String name,
                                 java.lang.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. If null then the parameter is sent as name rather than name=value
        Throws:
        java.lang.IllegalArgumentException - if a parameter with that name has already been set
      • getParameters

        public java.util.Map<java.lang.String,​java.lang.String> getParameters()
        Query string parameters. The returned map is an unmodifiable view of the map in the request so calls to addParameter(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 to null then no body is sent with the request.
      • setJsonEntity

        public void setJsonEntity​(java.lang.String entity)
        Set the body of the request to a string. If not set or set to null then no body is sent with the request. The Content-Type will be sent as application/json. If you need a different content type then use setEntity(HttpEntity).
      • getEntity

        public org.apache.http.HttpEntity getEntity()
        The body of the request. If null then 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.
      • toString

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object