Java Code Examples for org.elasticsearch.client.RestClientBuilder#setPathPrefix()

The following examples show how to use org.elasticsearch.client.RestClientBuilder#setPathPrefix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Elasticsearch6UpsertTableSink.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (maxRetryTimeout != null) {
		restClientBuilder.setMaxRetryTimeoutMillis(maxRetryTimeout);
	}
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}
 
Example 2
Source File: Elasticsearch6UpsertTableSink.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (maxRetryTimeout != null) {
		restClientBuilder.setMaxRetryTimeoutMillis(maxRetryTimeout);
	}
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}
 
Example 3
Source File: Elasticsearch6TableSink.java    From alchemy with Apache License 2.0 5 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
    if (maxRetryTimeout != null) {
        restClientBuilder.setMaxRetryTimeoutMillis(maxRetryTimeout);
    }
    if (pathPrefix != null) {
        restClientBuilder.setPathPrefix(pathPrefix);
    }
}
 
Example 4
Source File: ElasticsearchMigration.java    From elasticsearch-migration with Apache License 2.0 5 votes vote down vote up
private RestHighLevelClient createElasticsearchClient(ElasticsearchConfig elasticsearchConfig) {
    final RestClientBuilder builder = RestClient.builder(
            elasticsearchConfig.getUrls().stream().map(e -> new HttpHost(e.getHost(), e.getPort(), e.getProtocol())).collect(Collectors.toSet()).toArray(new HttpHost[0])
    );
    builder.setDefaultHeaders(elasticsearchConfig.getHeaders().entries().stream().map(e -> new BasicHeader(e.getKey(), e.getValue())).collect(Collectors.toList()).toArray(new Header[0]));

    if (elasticsearchConfig.getMaxRetryTimeoutMillis() != null) {
        builder.setMaxRetryTimeoutMillis(elasticsearchConfig.getMaxRetryTimeoutMillis());
    }
    if (elasticsearchConfig.getPathPrefix() != null) {
        builder.setPathPrefix(elasticsearchConfig.getPathPrefix());
    }

    return new RestHighLevelClient(builder);
}
 
Example 5
Source File: Elasticsearch6UpsertTableSink.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (maxRetryTimeout != null) {
		restClientBuilder.setMaxRetryTimeoutMillis(maxRetryTimeout);
	}
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}
 
Example 6
Source File: ElasticsearchSchemaFactory.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Builds elastic rest client from user configuration
 * @param hosts list of ES HTTP Hosts to connect to
 * @return newly initialized low-level rest http client for ES
 */
private static RestClient connect(List<HttpHost> hosts, String pathPrefix) {

  Objects.requireNonNull(hosts, "hosts or coordinates");
  Preconditions.checkArgument(!hosts.isEmpty(), "no ES hosts specified");

  RestClientBuilder builder = RestClient.builder(hosts.toArray(new HttpHost[hosts.size()]));
  if (pathPrefix != null && !pathPrefix.isEmpty()) {
    builder.setPathPrefix(pathPrefix);
  }
  return builder.build();
}
 
Example 7
Source File: Elasticsearch7UpsertTableSink.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}
 
Example 8
Source File: Elasticsearch7DynamicSink.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}
 
Example 9
Source File: Elasticsearch6DynamicSink.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void configureRestClientBuilder(RestClientBuilder restClientBuilder) {
	if (pathPrefix != null) {
		restClientBuilder.setPathPrefix(pathPrefix);
	}
}