RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder(); builder.setHttpAsyncResponseConsumerFactory( new HttpAsyncResponseConsumerFactory // Modified to 500MB .HeapBufferedResponseConsumerFactory(300 * 1024 * 1024 )); request.source(SearchSourceBuilder.searchSource().query(boolQueryBuilder).size(10000)); SearchResponse response = null; try { response = yqClient.search(request, builder.build()); } catch (IOException e) { e.printStackTrace(); }
Can also be set by reflection
// Set es query buffer size RequestOptions requestOptions = RequestOptions.DEFAULT; Class<? extends RequestOptions> reqClass = requestOptions.getClass(); Field reqField = reqClass.getDeclaredField("httpAsyncResponseConsumerFactory"); reqField.setAccessible(true); //remove final Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(reqField, reqField.getModifiers() & ~Modifier.FINAL); // Set the default factory reqField.set(requestOptions, new HttpAsyncResponseConsumerFactory() { @Override public HttpAsyncResponseConsumer<HttpResponse> createHttpAsyncResponseConsumer() { //500MB return new HeapBufferedAsyncResponseConsumer(5 * 100 * 1024 * 1024); }
Read More:
- .Net Core 5.0 Upload File limit via Swagger Api report error: error: request entity too large [Three Methods]
- [Solved] nodejs Error: request entity too large
- How to Solve Nginx 413 Error (request entity too large)
- [Solved] ELK Log System Error: “statusCode“:429,“error“:“Too Many Requests“,“message“ Data too large
- [Solved] sqoop Error: jSQLException in nextKeyValue Caused by: ORA-24920:column size too large for client
- [How to Solve] java.lang.IllegalArgumentException: Request header is too large
- [Solved] Intellij IDEA Error: Command line is too long
- Grafana Error: 414 Request-URI Too Large [How to Solve]
- Error running ‘xxxx‘“: Command line is too long… [How to Solve]
- [Solved] Intellij IDEA Run Error: Command line is too long
- [Solved] Browser Access Error: Request Header or Cookie too large
- [Solved] Nginx Error: 400 Request Header Or Cookie Too Large
- [Solved] Idea Run Error: Error running ‘Application‘: Command line is too long
- [Solved] Springboot Project Startup Error: Error running XXX. Command line is too long.
- [Solved] Android Studio Error: CreateProcess error = 206 file name or extension is too long
- error RC2247 : SYMBOL name too long [How to Solve]
- Error in plot.new() : figure margins too large
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for
- [Solved] Error running XxlJobExecutorHiveApplication. Command line is too long. Shorten the command line via
- Error running ‘PigSellCabinetApplication’: Command line is too long. Shorten command line for PigSellCabinetApplication or also for Spring Boot default configuration