elasticsearch/elasticsearch — Issue #1743: make the BaseQueryBuilder interface implement Clonable
Author: dnavre
Created: 2012-02-28 18:49:44+00:00
State: open

Because of this interface not implementing Clonable it's impossible to prepare and reuse parts of the query like this:

```java
BoolQueryBuilder queryPart1 = boolQuery()
for(int i = 0; i < arr.size(); i++) {
queryPart1.must(....);
}

BoolQueryBuilder mainQuery= boolQuery()
.should(
queryPart1
.must(...)
)
.should(
queryPart1
.sould(...)
);

```

I'm forced to create a new bool query at each point of reuse or externalize the creation of queryPart1 to a separate method and call it whenever i'm in need of that query part