Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/unreleased/pr-26633.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type = "f"
message = "Fix setting compression in OpenSearch client when enabled using `elasticsearch_compression_enabled`."

pulls = ["26633"]
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public RestHighLevelClient buildBasicRestClient(List<URI> hosts) {
}
return httpClientConfig;
})
.setChunkedEnabled(configuration.compressionEnabled());
.setCompressionEnabled(configuration.compressionEnabled());

return new RestHighLevelClient(restClientBuilder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public MoreSearch.Histogram eventHistogram(String queryString, AbsoluteRange tim

return dh;
})
.aggregations(TERMS_AGGREGATION_NAME, Aggregation.builder().terms(terms -> terms.minDocCount(0).field(EventDto.FIELD_ALERT)).build())
.aggregations(TERMS_AGGREGATION_NAME, Aggregation.builder().terms(terms -> terms.minDocCount(0L).field(EventDto.FIELD_ALERT)).build())
.build();

builder.aggregations(HISTOGRAM_AGGREGATION_NAME, histogramAggregation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public OpenSearchTransport buildTransport(List<URI> uris, TransportConfig config
.setAuthenticationEnabled(true)
);

builder.setChunkedEnabled(clientConfiguration.compressionEnabled());
builder.setCompressionEnabled(clientConfiguration.compressionEnabled());

builder.setHttpClientConfigCallback(httpClientBuilder -> {
final PoolingAsyncClientConnectionManagerBuilder connectionManagerBuilder = PoolingAsyncClientConnectionManagerBuilder.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.opensearch.client.opensearch.OpenSearchClient;
import org.opensearch.client.opensearch._types.ErrorResponse;
import org.opensearch.client.opensearch._types.OpenSearchException;
import org.opensearch.client.opensearch._types.ShardFailure;
import org.opensearch.client.opensearch._types.ShardSearchFailure;
import org.opensearch.client.opensearch._types.ShardStatistics;
import org.opensearch.client.opensearch.core.MsearchResponse;
import org.opensearch.client.opensearch.core.SearchRequest;
Expand Down Expand Up @@ -68,7 +68,7 @@ static void throwOnShardFailures(ShardStatistics shards) {
}
final var reason = String.format(Locale.ROOT, "%d of %d shards failed", shards.failed(), shards.total());
final var rootCauses = shards.failures().stream()
.map(ShardFailure::reason)
.map(ShardSearchFailure::reason)
.toList();
throw new OpenSearchException(ErrorResponse.of(r -> r
.status(500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
import org.opensearch.client.opensearch._types.ExpandWildcard;
import org.opensearch.client.opensearch._types.FieldValue;
import org.opensearch.client.opensearch._types.OpenSearchException;
import org.opensearch.client.opensearch._types.ShardFailure;
import org.opensearch.client.opensearch._types.ShardSearchFailure;
import org.opensearch.client.opensearch._types.Time;
import org.opensearch.client.opensearch._types.query_dsl.BoolQuery;
import org.opensearch.client.opensearch._types.query_dsl.MatchAllQuery;
Expand Down Expand Up @@ -457,7 +457,7 @@ private Optional<ElasticsearchException> checkForFailedShards(MultiSearchRespons
final MultiSearchItem<JsonData> searchResponse = multiSearchResponse.result();
if (searchResponse != null && searchResponse.shards().failed() > 0) {
final List<ErrorCause> shardFailures = searchResponse.shards().failures().stream()
.map(ShardFailure::reason)
.map(ShardSearchFailure::reason)
.toList();
final List<String> nonNumericFieldErrors = shardFailures
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.junit.jupiter.api.Test;
import org.opensearch.client.opensearch._types.ErrorCause;
import org.opensearch.client.opensearch._types.OpenSearchException;
import org.opensearch.client.opensearch._types.ShardFailure;
import org.opensearch.client.opensearch._types.ShardSearchFailure;
import org.opensearch.client.opensearch._types.ShardStatistics;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -37,7 +37,7 @@ void throwOnShardFailuresDoesNothingWhenAllShardsSucceeded() {

@Test
void throwOnShardFailuresDoesNothingWhenSomeShardsFailedButOthersSucceeded() {
final ShardFailure failure = ShardFailure.of(b -> b
final ShardSearchFailure failure = ShardSearchFailure.of(b -> b
.index("graylog_0")
.shard(2)
.reason(ErrorCause.of(c -> c.type("query_shard_exception").reason("parse error")))
Expand All @@ -54,7 +54,7 @@ void throwOnShardFailuresDoesNothingWhenSomeShardsFailedButOthersSucceeded() {

@Test
void throwOnShardFailuresThrowsWhenAllShardsFailed() {
final ShardFailure failure = ShardFailure.of(b -> b
final ShardSearchFailure failure = ShardSearchFailure.of(b -> b
.index("graylog_0")
.shard(2)
.reason(ErrorCause.of(c -> c.type("query_shard_exception").reason("parse error")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Maximum number of total connections per Elasticsearch route (normally this means
private String defaultPasswordForDiscoveredNodes = null;

@Documentation("""
Enable payload compression for Elasticsearch requests.
Enable payload compression for Elasticsearch requests and responses.

Default: false
""")
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

<!-- Dependencies -->
<opensearch.shaded.version>2.19.3-1</opensearch.shaded.version>
<opensearch.client.version>3.2.0</opensearch.client.version>
<opensearch.client.version>3.9.0</opensearch.client.version>
<airline.version>3.2.0</airline.version>
<amqp-client.version>5.32.0</amqp-client.version>
<antlr.version>4.13.2</antlr.version>
Expand Down
Loading