I am trying to increase the maximum response size allowed when searching with the elastic 8.6 new(ish) java client, but I don't see the option anywhere.
The search looks like this
SearchResponse<MyClass> response = connector.getClient().search(s -> s
.index(connector.getIndexName())
.query(q -> q
.match(t -> t
.field("whatever")
.query(query)
)
)
.size(1000)
MyClass.class
);
And I found that there's a RequestOptions
class which allows to set HTTP params, but I don't see anywhere how to plug it to the Request builder
var customOptionsBuilder = RequestOptions.DEFAULT.toBuilder();
customOptionsBuilder.setHttpAsyncResponseConsumerFactory(
new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(MAX_HTTP_RESPONSE_SIZE)
);
this.customOptions = customOptionsBuilder.build();
I need to retrieve exactly 1000 results in one sitting, and the response sizes are just a little bit above 100MiB...
This seems a way to do it, you have to provide it when building the LowLevelClient
RequestOptions.Builder options = RequestOptions.DEFAULT.toBuilder();
options.setHttpAsyncResponseConsumerFactory(
new HttpAsyncResponseConsumerFactory.HeapBufferedResponseConsumerFactory(MAX_RESPONSE_ENTITY_SIZE)
);
ElasticsearchTransport transport = new RestClientTransport(
restClient, new JacksonJsonpMapper(), new RestClientOptions.Builder(options).build());
client = new ElasticsearchClient(transport);