Skip to content

RestClient should allow compressing request bodies #62044

@swallez

Description

@swallez

The Rest client has transparent support for compressed responses, but no support for compressed requests.

The low-level client should make it easy to compress request bodies, either globally or per-request. The high-level client should automatically benefit from this feature.

Compressing the request body should be driven by adding the corresponding header on RequestOptions, e.g.:

RequestOptions gzipOptions = RequestOptions.DEFAULT.toBuilder().addHeader("Content-Encoding", "gzip").build();
esClient.search(new SearchRequest("foo"), gzipOptions);

We can also add a more convenient RequestOption.compress(true) but ultimately that will set the header option as illustrated above, since that header can always be set directly.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions