I am using the version 7.15.2 and couldn't figure out how to use RangeQueryBuilder. Currently I am creating a JsonValue object and passing it to Query.Builder 's range method as below:
final String json = "{ \"fld_date\": {\"gte\": \"2018-02-02T15:08:28Z\", \"lte\": \"2021-06-19T16:03:01.130Z\"}}";
final JsonpMapper mapper = new JsonbJsonpMapper();
final JsonParser parser = mapper.jsonProvider().createParser(new StringReader(json));
final JsonData data = JsonData.from(parser, mapper);
final JsonValue value = data.toJson(mapper);
Query.Builder rangeBuilder = new Query.Builder();
rangeBuilder.range(value );
See the post:
https://discuss.elastic.co/t/date-range-java-api-examples/295505/2