Date range java api examples

Following code works. Please suggest if there is any better option.

        final String json = "{ \"fld_date\": {\"gte\": \"2018-02-02T15:08:28Z\", \"lte\": \"2021-06-23T11:35:01.120Z\"}}";
        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);
        SearchResponse<JsonNode> search = esClient.search(s -> s
                .index(index)
                .query( q -> q.range(value)), JsonNode.class);