Hello,
What would be the best way to clone an AbtractQueryBuilder? I have a BoolQueryBuilder that I'd like to use as a filter as part of another query. I noticed that when I compose into another query later modify it, the formerly composed objects are also modified. But I'd like to make it stay at the time of composition. I figure cloning is one way to resolve this.
Looking at the Javadocs, it looks like copying may be possible with
- AbstractQueryBuilder.toXContent(...) and .fromXContent(...)
- AbstractQueryBuilder.toString() then use QueryBuilders.wrapperQuery(...)
But I'm not sure if this is the best way as I think this would serialize and deserialize unnecessarily.
Thank you.