title: How to manage properly Elastic Java Rest Client timeout
body: <p>We are using elastic java rest high client 6.1, but often and randomly the rest client return an timeout.</p>
  
  <p>We alredy customize timeout in this way:</p>
  
  <pre><code>        client.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback {
          override def customizeRequestConfig(requestConfigBuilder: RequestConfig.Builder): RequestConfig.Builder = {
              requestConfigBuilder
                  .setConnectionRequestTimeout(0)
                  .setConnectTimeout(parameters.getInt(s"$propertyGroup.timeout.connection"))
                  .setSocketTimeout(parameters.getInt(s"$propertyGroup.timeout.socket"))
          }
      }).setMaxRetryTimeoutMillis(parameters.getInt(s"$propertyGroup.timeout.socket"))
          .setFailureListener(new RestClient.FailureListener {
              override def onFailure(host: HttpHost): Unit = {
                  val a = 0
              }
          })
  </code></pre>
  
  <p>And during our test we set timeout threshold in 60000ms, 100000ms, 180000ms; and still randomly get a timeout exception.</p>
  
  <p>This issue happens only when we run a FLINK JOB that run as much fast it can many queries in parallel, or when we query elastic into a ForEach with billions of iterations.</p>
  
  <p>There is a strategy, idea, snippet of code, configuration, best practise, etc. to: Wait few seconds (or milliseconds) and try again to execute the failed query?</p>