Using BoolQuery.Builder with NativeQuery

Hi. Maybe this is basic, but I can't find the answer.
I used to have this code:

...
BoolQueryBuilder boolQueryBuilder = processElasticRequest()

NativeSearchQuery query = new NativeSearchQueryBuilder()
          .withQuery(boolQueryBuilder)
          .withPageable(req)
          .build();

I've upgraded and have this:


BoolQuery.Builder boolQueryBuilder = handleElasticRequest()

NativeQuery query = NativeQuery.builder()
                    .withQuery(boolQueryBuilder.build()._toQuery())
                    .withPageable(Pageable.unpaged())
                    .build();

However, that does not seem correct, and the results aren't returned. What have I done wrong?

Thanks!

Hello!
Sorry we can't help you with this one, NativeQuery is a spring data class, so I'm not sure what their requirements are for usage and integration with the elasticsearch java client.