コード例 #1
0
 public InputStream scroll(String scrollId) throws IOException {
   // use post instead of get to avoid some weird encoding issues (caused by the long URL)
   return execute(
           POST,
           "_search/scroll?scroll=" + scrollKeepAlive.toString(),
           new BytesArray(scrollId.getBytes(StringUtils.UTF_8)))
       .body();
 }
コード例 #2
0
  public boolean health(String index, HEALTH health, TimeValue timeout) throws IOException {
    StringBuilder sb = new StringBuilder("/_cluster/health/");
    sb.append(index);
    sb.append("?wait_for_status=");
    sb.append(health.name().toLowerCase(Locale.ENGLISH));
    sb.append("&timeout=");
    sb.append(timeout.toString());

    return (Boolean.TRUE.equals(get(sb.toString(), "timed_out")));
  }
コード例 #3
0
  public RestClient(Settings settings) {
    network = new NetworkClient(settings, SettingsUtils.nodes(settings));

    scrollKeepAlive = TimeValue.timeValueMillis(settings.getScrollKeepAlive());
    indexReadMissingAsEmpty = settings.getIndexReadMissingAsEmpty();

    String retryPolicyName = settings.getBatchWriteRetryPolicy();

    if (ConfigurationOptions.ES_BATCH_WRITE_RETRY_POLICY_SIMPLE.equals(retryPolicyName)) {
      retryPolicyName = SimpleHttpRetryPolicy.class.getName();
    } else if (ConfigurationOptions.ES_BATCH_WRITE_RETRY_POLICY_NONE.equals(retryPolicyName)) {
      retryPolicyName = NoHttpRetryPolicy.class.getName();
    }

    retryPolicy = ObjectUtils.instantiate(retryPolicyName, settings);
  }
コード例 #4
0
 public long getScrollKeepAlive() {
   return TimeValue.parseTimeValue(getProperty(ES_SCROLL_KEEPALIVE, ES_SCROLL_KEEPALIVE_DEFAULT))
       .getMillis();
 }
コード例 #5
0
 public long getBatchWriteRetryWait() {
   return TimeValue.parseTimeValue(
           getProperty(ES_BATCH_WRITE_RETRY_WAIT, ES_BATCH_WRITE_RETRY_WAIT_DEFAULT))
       .getMillis();
 }
コード例 #6
0
 public long getHttpTimeout() {
   return TimeValue.parseTimeValue(getProperty(ES_HTTP_TIMEOUT, ES_HTTP_TIMEOUT_DEFAULT))
       .getMillis();
 }