Im using elastic search for data retrieval and so that I build my elastic queries using SearchRequest builder provided by elastic java api client. Problem is once the build method in Search Request is called it won't allow me to do a build once again. So I need to copy my source search request to a destination search request and play with it without touching source request. I tried using
SearchRequest.Builder dest = new SearchRequest.Builder();
SearchRequest.Builder source = buildSourceQuery(); // I'm building my search request in this method
BeanUtils.copyProperties(dest, source);
this.elasticSearchClient.search(dest.build(), Product.class);
On calling dest.build() method one of the field gets updated to true by elastic and it reflects in my source request as well with no option to set value for it. I need my source search request not be updated whenever dest is changed or updated.