Replacement of QueryBuilder(ES 5.6) in ES 8.5

Hi,
We have been using the ES 5.6 cluster, but are now migrating to a new ES 8.5 cluster. The Data migration, and indexing queries are all sorted. However, earlier we used to use QueryBuilder in ES 5.6 java app and there is no example of this in the new Java Client Library of ES. Would it be possible if we could get an example, of how we can dynamically create queries, by adding boolean statements.
Thank You

I think you'll find a good start here:

Hi @dadoonet , thanks for a quick response. However, I have gone through this page before and this provides a functional approach to building queries. We cannot add queries to it, condition by condition. We'll have to make the query at once. Is there a way to do this using the Builder approach, if any?

I think that you can use something similar as shown in Searching for documents | Elasticsearch Java API Client [8.6] | Elastic

Query byName = MatchQuery.of(m -> m 
    .field("name")
    .query(searchText)
)._toQuery();