Class RestClientFactory


  • public class RestClientFactory
    extends Object
    This factory wraps the JestClientFactory to provide instances of JestClient.
    • Constructor Detail

      • RestClientFactory

        public RestClientFactory​(String elasticSearchURL,
                                 String globalElasticUser,
                                 String globalElasticPassword)
                          throws MalformedURLException
        Create a RestClientFactory.
        Parameters:
        elasticSearchURL - Elasticsearch URL, either a single URL or multiple URLs that are comma-separated without spaces
        globalElasticUser - Optional HTTP username
        globalElasticPassword - Optional HTTP password
        Throws:
        MalformedURLException
    • Method Detail

      • setRetries

        public void setRetries​(int retries)
        Set the number of times the REST operation will be retried if an exception is thrown during the operation.
        Parameters:
        retries - Number of retries.
      • setSocketTimeout

        public void setSocketTimeout​(int timeout)
        Set the socket timeout (SO_TIMEOUT) for the REST connections. This is the maximum period of inactivity while waiting for incoming data. A default value of 3000 is specified in io.searchbox.client.config.ClientConfig.AbstractBuilder.
        Parameters:
        timeout - Timeout in milliseconds.
      • setTimeout

        public void setTimeout​(int timeout)
        Set the connection timeout for the REST connections. A default value of 3000 is specified in io.searchbox.client.config.ClientConfig.AbstractBuilder. This is also used as the minimum interval between successive retries if the connection is refused in a shorter amount of time.
        Parameters:
        timeout - Timeout in milliseconds.
      • setConnTimeout

        public void setConnTimeout​(int timeout)
      • setReadTimeout

        public void setReadTimeout​(int timeout)
      • setMultiThreaded

        public void setMultiThreaded​(boolean multiThreaded)
      • setDefaultMaxTotalConnectionPerRoute

        public void setDefaultMaxTotalConnectionPerRoute​(int connections)
        Set the default max connections per route. By default, we use the number of available processors * 2. If a negative value is given, the set is ignored. This allows us to use -1 as the default in the Blueprint in order to avoid having to caculate the default again there.
        Parameters:
        connections - default max connections per route
      • setMaxTotalConnection

        public void setMaxTotalConnection​(int connections)
        Set the default max total connections. By default, we use the default max connections per route * 3. If a negative value is given, the set is ignored. This allows us to use -1 as the default in the Blueprint in order to avoid having to caculate the default again there.
        Parameters:
        connections - default max connections per route
      • setDiscovery

        public void setDiscovery​(boolean discovery)
        Defines if discovery/sniffing of nodes in the cluster is enabled.
        Parameters:
        discovery - true if discovery should be enabled, false otherwise
      • setDiscoveryFrequency

        public void setDiscoveryFrequency​(int discoveryFrequencyInSeconds)
        Sets the frequency to discover the nodes in the cluster. Note: This only works if discovery is enabled.
        Parameters:
        discoveryFrequencyInSeconds - frequency in seconds
      • setMaxConnectionIdleTime

        public void setMaxConnectionIdleTime​(int timeout,
                                             TimeUnit unit)
      • setHttpCompression

        public void setHttpCompression​(boolean httpCompression)
      • setRequestExecutorFactory

        public void setRequestExecutorFactory​(RequestExecutorFactory requestExecutorFactory)
      • setRequestExecutorSupplier

        public void setRequestExecutorSupplier​(java.util.function.Supplier<RequestExecutor> requestExecutorSupplier)
      • createClient

        public io.searchbox.client.JestClient createClient()
      • setIgnoreCertificates

        public void setIgnoreCertificates​(boolean ignoreCertificates)
        Allow insecure HTTPS/SSL connections.
        Parameters:
        ignoreCertificates -