Description
org.elasticsearch.client.HeapBufferedAsyncResponseConsumer
imposes a limit (default 100MiB) on the size of responses it'll accept. However this limit only applies to responses with a Content-length
header, and therefore does not restrict the heap memory usage when receiving a response with Transfer-encoding: chunked
. These days pretty much all large responses are chunked so in practice this limit doesn't really do anything any more. Should we fix it to apply to all responses so as to protect clients from OOMEs? At the very least we should probably mention this anomaly in our docs somewhere.
Workaround
Use org.elasticsearch.client.RequestOptions.Builder#setHttpAsyncResponseConsumerFactory
to provide a response consumer which does handle chunked responses correctly.