diff --git a/src/main/java/org/elasticsearch/index/query/AndQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/AndQueryBuilder.java
index 1492a70d01c..ecc63274426 100644
--- a/src/main/java/org/elasticsearch/index/query/AndQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/AndQueryBuilder.java
@@ -39,6 +39,8 @@ public class AndQueryBuilder extends QueryBuilder {
private String queryName;
+ static final AndQueryBuilder PROTOTYPE = new AndQueryBuilder();
+
public AndQueryBuilder(QueryBuilder... filters) {
for (QueryBuilder filter : filters) {
this.filters.add(filter);
diff --git a/src/main/java/org/elasticsearch/index/query/AndQueryParser.java b/src/main/java/org/elasticsearch/index/query/AndQueryParser.java
index afafcdb723d..601d69e5700 100644
--- a/src/main/java/org/elasticsearch/index/query/AndQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/AndQueryParser.java
@@ -115,4 +115,9 @@ public class AndQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public AndQueryBuilder getBuilderPrototype() {
+ return AndQueryBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java
index 9d39344a71f..6977e100a4f 100644
--- a/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java
@@ -51,6 +51,8 @@ public class BoolQueryBuilder extends QueryBuilder implements BoostableQueryBuil
private String queryName;
+ static final BoolQueryBuilder PROTOTYPE = new BoolQueryBuilder();
+
/**
* Adds a query that must appear in the matching documents and will
* contribute to scoring.
diff --git a/src/main/java/org/elasticsearch/index/query/BoolQueryParser.java b/src/main/java/org/elasticsearch/index/query/BoolQueryParser.java
index 403f65d04dd..34a947c302f 100644
--- a/src/main/java/org/elasticsearch/index/query/BoolQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/BoolQueryParser.java
@@ -171,4 +171,9 @@ public class BoolQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public BoolQueryBuilder getBuilderPrototype() {
+ return BoolQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java
index 9c6762602ba..7a67ce3a603 100644
--- a/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java
@@ -47,8 +47,9 @@ public class BoostingQueryBuilder extends QueryBuilder implements BoostableQuery
private float boost = -1;
- public BoostingQueryBuilder() {
+ static final BoostingQueryBuilder PROTOTYPE = new BoostingQueryBuilder();
+ public BoostingQueryBuilder() {
}
public BoostingQueryBuilder positive(QueryBuilder positiveQuery) {
diff --git a/src/main/java/org/elasticsearch/index/query/BoostingQueryParser.java b/src/main/java/org/elasticsearch/index/query/BoostingQueryParser.java
index 89f87a57551..897cabaf33c 100644
--- a/src/main/java/org/elasticsearch/index/query/BoostingQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/BoostingQueryParser.java
@@ -98,4 +98,9 @@ public class BoostingQueryParser extends BaseQueryParserTemp {
}
return boostingQuery;
}
+
+ @Override
+ public BoostingQueryBuilder getBuilderPrototype() {
+ return BoostingQueryBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java
index f5960c814a2..7f016c8b2ff 100644
--- a/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java
@@ -72,6 +72,8 @@ public class CommonTermsQueryBuilder extends QueryBuilder implements BoostableQu
private String queryName;
+ static final CommonTermsQueryBuilder PROTOTYPE = new CommonTermsQueryBuilder();
+
/**
* Constructs a new common terms query.
*/
@@ -86,6 +88,14 @@ public class CommonTermsQueryBuilder extends QueryBuilder implements BoostableQu
this.name = name;
}
+ /**
+ * private constructor used onyl internally
+ */
+ private CommonTermsQueryBuilder() {
+ this.text = null;
+ this.name = null;
+ }
+
/**
* Sets the operator to use for terms with a high document frequency
* (greater than or equal to {@link #cutoffFrequency(float)}. Defaults to
diff --git a/src/main/java/org/elasticsearch/index/query/CommonTermsQueryParser.java b/src/main/java/org/elasticsearch/index/query/CommonTermsQueryParser.java
index 54322e17226..7e261568361 100644
--- a/src/main/java/org/elasticsearch/index/query/CommonTermsQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/CommonTermsQueryParser.java
@@ -219,4 +219,9 @@ public class CommonTermsQueryParser extends BaseQueryParserTemp {
query.setHighFreqMinimumNumberShouldMatch(highFreqMinimumShouldMatch);
return query;
}
+
+ @Override
+ public CommonTermsQueryBuilder getBuilderPrototype() {
+ return CommonTermsQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryBuilder.java
index 0ca9470d2f8..53b2a7bc757 100644
--- a/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryBuilder.java
@@ -37,6 +37,8 @@ public class ConstantScoreQueryBuilder extends QueryBuilder implements Boostable
private float boost = -1;
+ static final ConstantScoreQueryBuilder PROTOTYPE = new ConstantScoreQueryBuilder();
+
/**
* A query that wraps a query and simply returns a constant score equal to the
* query boost for every document in the query.
@@ -47,6 +49,13 @@ public class ConstantScoreQueryBuilder extends QueryBuilder implements Boostable
this.filterBuilder = Objects.requireNonNull(filterBuilder);
}
+ /**
+ * private constructor only used for serialization
+ */
+ private ConstantScoreQueryBuilder() {
+ this.filterBuilder = null;
+ }
+
/**
* Sets the boost for this query. Documents matching this query will (in addition to the normal
* weightings) have their score multiplied by the boost provided.
diff --git a/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryParser.java b/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryParser.java
index 6545a4086fd..504eb8d5a74 100644
--- a/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/ConstantScoreQueryParser.java
@@ -86,4 +86,9 @@ public class ConstantScoreQueryParser extends BaseQueryParserTemp {
filter.setBoost(boost);
return filter;
}
+
+ @Override
+ public ConstantScoreQueryBuilder getBuilderPrototype() {
+ return ConstantScoreQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/DisMaxQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/DisMaxQueryBuilder.java
index 410fd1cc555..a6927899412 100644
--- a/src/main/java/org/elasticsearch/index/query/DisMaxQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/DisMaxQueryBuilder.java
@@ -43,6 +43,8 @@ public class DisMaxQueryBuilder extends QueryBuilder implements BoostableQueryBu
private String queryName;
+ static final DisMaxQueryBuilder PROTOTYPE = new DisMaxQueryBuilder();
+
/**
* Add a sub-query to this disjunction.
*/
diff --git a/src/main/java/org/elasticsearch/index/query/DisMaxQueryParser.java b/src/main/java/org/elasticsearch/index/query/DisMaxQueryParser.java
index 145890ae17d..20ff9325147 100644
--- a/src/main/java/org/elasticsearch/index/query/DisMaxQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/DisMaxQueryParser.java
@@ -111,4 +111,9 @@ public class DisMaxQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public DisMaxQueryBuilder getBuilderPrototype() {
+ return DisMaxQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
index 8e25be30292..f59b861a9e6 100644
--- a/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
@@ -34,6 +34,8 @@ public class ExistsQueryBuilder extends QueryBuilder {
private String queryName;
+ static final ExistsQueryBuilder PROTOTYPE = new ExistsQueryBuilder(null);
+
public ExistsQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/ExistsQueryParser.java b/src/main/java/org/elasticsearch/index/query/ExistsQueryParser.java
index 1a35dfbbaeb..3da9a66b843 100644
--- a/src/main/java/org/elasticsearch/index/query/ExistsQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/ExistsQueryParser.java
@@ -122,4 +122,9 @@ public class ExistsQueryParser extends BaseQueryParserTemp {
return new ConstantScoreQuery(boolFilter);
}
+ @Override
+ public ExistsQueryBuilder getBuilderPrototype() {
+ return ExistsQueryBuilder.PROTOTYPE;
+ }
+
}
diff --git a/src/main/java/org/elasticsearch/index/query/FQueryFilterParser.java b/src/main/java/org/elasticsearch/index/query/FQueryFilterParser.java
index 25851d718f8..9003c7c16f0 100644
--- a/src/main/java/org/elasticsearch/index/query/FQueryFilterParser.java
+++ b/src/main/java/org/elasticsearch/index/query/FQueryFilterParser.java
@@ -84,4 +84,9 @@ public class FQueryFilterParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public QueryFilterBuilder getBuilderPrototype() {
+ return QueryFilterBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java
index ac6c19ecc0c..acd0a38265f 100644
--- a/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java
@@ -35,6 +35,8 @@ public class FieldMaskingSpanQueryBuilder extends QueryBuilder implements SpanQu
private String queryName;
+ static final FieldMaskingSpanQueryBuilder PROTOTYPE = new FieldMaskingSpanQueryBuilder(null, null);
+
public FieldMaskingSpanQueryBuilder(SpanQueryBuilder queryBuilder, String field) {
this.queryBuilder = queryBuilder;
this.field = field;
diff --git a/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryParser.java b/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryParser.java
index e072fdb6fd3..aafa33ad3fc 100644
--- a/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryParser.java
@@ -100,4 +100,9 @@ public class FieldMaskingSpanQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public FieldMaskingSpanQueryBuilder getBuilderPrototype() {
+ return FieldMaskingSpanQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/FilteredQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/FilteredQueryBuilder.java
index a1955d556ed..90093461896 100644
--- a/src/main/java/org/elasticsearch/index/query/FilteredQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/FilteredQueryBuilder.java
@@ -41,6 +41,8 @@ public class FilteredQueryBuilder extends QueryBuilder implements BoostableQuery
private String queryName;
+ static final FilteredQueryBuilder PROTOTYPE = new FilteredQueryBuilder(null, null);
+
/**
* A query that applies a filter to the results of another query.
*
diff --git a/src/main/java/org/elasticsearch/index/query/FilteredQueryParser.java b/src/main/java/org/elasticsearch/index/query/FilteredQueryParser.java
index 8e4b701a78a..d9153e72bc4 100644
--- a/src/main/java/org/elasticsearch/index/query/FilteredQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/FilteredQueryParser.java
@@ -118,4 +118,9 @@ public class FilteredQueryParser extends BaseQueryParserTemp {
}
return filteredQuery;
}
+
+ @Override
+ public FilteredQueryBuilder getBuilderPrototype() {
+ return FilteredQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/FuzzyQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/FuzzyQueryBuilder.java
index 6790a0c8d29..9f222917e75 100644
--- a/src/main/java/org/elasticsearch/index/query/FuzzyQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/FuzzyQueryBuilder.java
@@ -50,6 +50,8 @@ public class FuzzyQueryBuilder extends MultiTermQueryBuilder implements Boostabl
private String queryName;
+ static final FuzzyQueryBuilder PROTOTYPE = new FuzzyQueryBuilder(null, null);
+
/**
* Constructs a new term query.
*
diff --git a/src/main/java/org/elasticsearch/index/query/FuzzyQueryParser.java b/src/main/java/org/elasticsearch/index/query/FuzzyQueryParser.java
index 0595c7ce6e2..dde7da8b65f 100644
--- a/src/main/java/org/elasticsearch/index/query/FuzzyQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/FuzzyQueryParser.java
@@ -130,4 +130,9 @@ public class FuzzyQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public FuzzyQueryBuilder getBuilderPrototype() {
+ return FuzzyQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java
index 4f6f1552c7b..f334cac1ebf 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java
@@ -44,6 +44,8 @@ public class GeoBoundingBoxQueryBuilder extends QueryBuilder {
private String queryName;
private String type;
+ static final GeoBoundingBoxQueryBuilder PROTOTYPE = new GeoBoundingBoxQueryBuilder(null);
+
public GeoBoundingBoxQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryParser.java b/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryParser.java
index 22cb24d79f8..daf4c269634 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryParser.java
@@ -74,14 +74,14 @@ public class GeoBoundingBoxQueryParser extends BaseQueryParserTemp {
double bottom = Double.NaN;
double left = Double.NaN;
double right = Double.NaN;
-
+
String queryName = null;
String currentFieldName = null;
XContentParser.Token token;
boolean normalize = true;
GeoPoint sparse = new GeoPoint();
-
+
String type = "memory";
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
@@ -148,7 +148,7 @@ public class GeoBoundingBoxQueryParser extends BaseQueryParserTemp {
final GeoPoint bottomRight = new GeoPoint(bottom, right);
if (normalize) {
- // Special case: if the difference bettween the left and right is 360 and the right is greater than the left, we are asking for
+ // Special case: if the difference bettween the left and right is 360 and the right is greater than the left, we are asking for
// the complete longitude range so need to set longitude to the complete longditude range
boolean completeLonRange = ((right - left) % 360 == 0 && right > left);
GeoUtils.normalizePoint(topLeft, true, !completeLonRange);
@@ -183,5 +183,10 @@ public class GeoBoundingBoxQueryParser extends BaseQueryParserTemp {
parseContext.addNamedQuery(queryName, filter);
}
return filter;
- }
+ }
+
+ @Override
+ public GeoBoundingBoxQueryBuilder getBuilderPrototype() {
+ return GeoBoundingBoxQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java
index 3b7551bc555..066bdaee85a 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java
@@ -46,6 +46,8 @@ public class GeoDistanceQueryBuilder extends QueryBuilder {
private String queryName;
+ static final GeoDistanceQueryBuilder PROTOTYPE = new GeoDistanceQueryBuilder(null);
+
public GeoDistanceQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryParser.java b/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryParser.java
index ea588b8bfd2..6f3efe08682 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryParser.java
@@ -162,4 +162,9 @@ public class GeoDistanceQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public GeoDistanceQueryBuilder getBuilderPrototype() {
+ return GeoDistanceQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java
index 467929ea9d3..85466fe30a4 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java
@@ -48,6 +48,8 @@ public class GeoDistanceRangeQueryBuilder extends QueryBuilder {
private String optimizeBbox;
+ static final GeoDistanceRangeQueryBuilder PROTOTYPE = new GeoDistanceRangeQueryBuilder(null);
+
public GeoDistanceRangeQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryParser.java b/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryParser.java
index a55bd3265d9..4c2ef538066 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryParser.java
@@ -201,4 +201,9 @@ public class GeoDistanceRangeQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public GeoDistanceRangeQueryBuilder getBuilderPrototype() {
+ return GeoDistanceRangeQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryBuilder.java
index 4ba38cd94d3..cf2c96e02fe 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryBuilder.java
@@ -40,6 +40,8 @@ public class GeoPolygonQueryBuilder extends QueryBuilder {
private String queryName;
+ static final GeoPolygonQueryBuilder PROTOTYPE = new GeoPolygonQueryBuilder(null);
+
public GeoPolygonQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryParser.java b/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryParser.java
index ea1fa7b67b0..12ae0aa90bb 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoPolygonQueryParser.java
@@ -150,4 +150,9 @@ public class GeoPolygonQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public GeoPolygonQueryBuilder getBuilderPrototype() {
+ return GeoPolygonQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java
index df57ba9d5f6..4e901892ed3 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java
@@ -49,6 +49,8 @@ public class GeoShapeQueryBuilder extends QueryBuilder {
private ShapeRelation relation = null;
+ static final GeoShapeQueryBuilder PROTOTYPE = new GeoShapeQueryBuilder(null, null);
+
/**
* Creates a new GeoShapeQueryBuilder whose Filter will be against the
* given field name using the given Shape
diff --git a/src/main/java/org/elasticsearch/index/query/GeoShapeQueryParser.java b/src/main/java/org/elasticsearch/index/query/GeoShapeQueryParser.java
index 9e3478f8358..dae2762e22b 100644
--- a/src/main/java/org/elasticsearch/index/query/GeoShapeQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/GeoShapeQueryParser.java
@@ -189,4 +189,9 @@ public class GeoShapeQueryParser extends BaseQueryParserTemp {
throw new IllegalArgumentException("");
}
}
+
+ @Override
+ public GeoShapeQueryBuilder getBuilderPrototype() {
+ return GeoShapeQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/GeohashCellQuery.java b/src/main/java/org/elasticsearch/index/query/GeohashCellQuery.java
index c84070e0b4f..b95d059ddf7 100644
--- a/src/main/java/org/elasticsearch/index/query/GeohashCellQuery.java
+++ b/src/main/java/org/elasticsearch/index/query/GeohashCellQuery.java
@@ -98,6 +98,7 @@ public class GeohashCellQuery {
private String geohash;
private int levels = -1;
private boolean neighbors;
+ private static final Builder PROTOTYPE = new Builder(null);
public Builder(String field) {
@@ -270,5 +271,10 @@ public class GeohashCellQuery {
return filter;
}
+
+ @Override
+ public GeohashCellQuery.Builder getBuilderPrototype() {
+ return Builder.PROTOTYPE;
+ }
}
}
diff --git a/src/main/java/org/elasticsearch/index/query/HasChildQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/HasChildQueryBuilder.java
index cbd869a20c3..036eb694468 100644
--- a/src/main/java/org/elasticsearch/index/query/HasChildQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/HasChildQueryBuilder.java
@@ -45,6 +45,8 @@ public class HasChildQueryBuilder extends QueryBuilder implements BoostableQuery
private QueryInnerHitBuilder innerHit = null;
+ static final HasChildQueryBuilder PROTOTYPE = new HasChildQueryBuilder(null, null);
+
public HasChildQueryBuilder(String type, QueryBuilder queryBuilder) {
this.childType = type;
this.queryBuilder = queryBuilder;
diff --git a/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java b/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java
index 5af04c6d29e..d0efd97a695 100644
--- a/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java
@@ -187,4 +187,9 @@ public class HasChildQueryParser extends BaseQueryParserTemp {
query.setBoost(boost);
return query;
}
+
+ @Override
+ public HasChildQueryBuilder getBuilderPrototype() {
+ return HasChildQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/HasParentQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/HasParentQueryBuilder.java
index e422be8f419..9226a5e38a0 100644
--- a/src/main/java/org/elasticsearch/index/query/HasParentQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/HasParentQueryBuilder.java
@@ -35,6 +35,7 @@ public class HasParentQueryBuilder extends QueryBuilder implements BoostableQuer
private float boost = 1.0f;
private String queryName;
private QueryInnerHitBuilder innerHit = null;
+ static final HasParentQueryBuilder PROTOTYPE = new HasParentQueryBuilder(null, null);
/**
* @param parentType The parent type
diff --git a/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java b/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java
index 287b2178b54..6ff290075d6 100644
--- a/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java
@@ -203,4 +203,9 @@ public class HasParentQueryParser extends BaseQueryParserTemp {
}
}
+ @Override
+ public HasParentQueryBuilder getBuilderPrototype() {
+ return HasParentQueryBuilder.PROTOTYPE;
+ }
+
}
diff --git a/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java
index 4be719fdd23..7d54c0479ec 100644
--- a/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java
@@ -20,6 +20,7 @@
package org.elasticsearch.index.query;
import com.google.common.collect.Sets;
+
import org.apache.lucene.queries.TermsQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.cluster.metadata.MetaData;
@@ -49,6 +50,8 @@ public class IdsQueryBuilder extends QueryBuilder implements Bo
private String queryName;
+ static final IdsQueryBuilder PROTOTYPE = new IdsQueryBuilder();
+
/**
* Creates a new IdsQueryBuilder by optionally providing the types of the documents to look for
*/
diff --git a/src/main/java/org/elasticsearch/index/query/IdsQueryParser.java b/src/main/java/org/elasticsearch/index/query/IdsQueryParser.java
index 48af1f107a0..5ce95deaff3 100644
--- a/src/main/java/org/elasticsearch/index/query/IdsQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/IdsQueryParser.java
@@ -107,4 +107,9 @@ public class IdsQueryParser extends BaseQueryParser {
query.validate();
return query;
}
+
+ @Override
+ public IdsQueryBuilder getBuilderPrototype() {
+ return IdsQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/IndicesQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/IndicesQueryBuilder.java
index 4e3cce86527..c251157a161 100644
--- a/src/main/java/org/elasticsearch/index/query/IndicesQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/IndicesQueryBuilder.java
@@ -40,6 +40,8 @@ public class IndicesQueryBuilder extends QueryBuilder {
private String queryName;
+ static final IndicesQueryBuilder PROTOTYPE = new IndicesQueryBuilder(null);
+
public IndicesQueryBuilder(QueryBuilder queryBuilder, String... indices) {
this.queryBuilder = queryBuilder;
this.indices = indices;
diff --git a/src/main/java/org/elasticsearch/index/query/IndicesQueryParser.java b/src/main/java/org/elasticsearch/index/query/IndicesQueryParser.java
index c77e6c53fe2..a369f703872 100644
--- a/src/main/java/org/elasticsearch/index/query/IndicesQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/IndicesQueryParser.java
@@ -157,4 +157,9 @@ public class IndicesQueryParser extends BaseQueryParserTemp {
}
return false;
}
+
+ @Override
+ public IndicesQueryBuilder getBuilderPrototype() {
+ return IndicesQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/LimitQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/LimitQueryBuilder.java
index 76d4148cceb..f397d216ba3 100644
--- a/src/main/java/org/elasticsearch/index/query/LimitQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/LimitQueryBuilder.java
@@ -32,6 +32,7 @@ public class LimitQueryBuilder extends QueryBuilder {
public static final String NAME = "limit";
private final int limit;
+ static final LimitQueryBuilder PROTOTYPE = new LimitQueryBuilder(-1);
public LimitQueryBuilder(int limit) {
this.limit = limit;
diff --git a/src/main/java/org/elasticsearch/index/query/LimitQueryParser.java b/src/main/java/org/elasticsearch/index/query/LimitQueryParser.java
index 87692ed19d2..ce4b88aaf57 100644
--- a/src/main/java/org/elasticsearch/index/query/LimitQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/LimitQueryParser.java
@@ -64,4 +64,9 @@ public class LimitQueryParser extends BaseQueryParserTemp {
// this filter is deprecated and parses to a filter that matches everything
return Queries.newMatchAllQuery();
}
+
+ @Override
+ public LimitQueryBuilder getBuilderPrototype() {
+ return LimitQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/MatchAllQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/MatchAllQueryBuilder.java
index 992acc6dd7a..f9407fbefa8 100644
--- a/src/main/java/org/elasticsearch/index/query/MatchAllQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/MatchAllQueryBuilder.java
@@ -37,6 +37,8 @@ public class MatchAllQueryBuilder extends QueryBuilder imp
private float boost = 1.0f;
+ static final MatchAllQueryBuilder PROTOTYPE = new MatchAllQueryBuilder();
+
/**
* Sets the boost for this query. Documents matching this query will (in addition to the normal
* weightings) have their score multiplied by the boost provided.
diff --git a/src/main/java/org/elasticsearch/index/query/MatchAllQueryParser.java b/src/main/java/org/elasticsearch/index/query/MatchAllQueryParser.java
index 8e46e1d000d..157d6d72a2b 100644
--- a/src/main/java/org/elasticsearch/index/query/MatchAllQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/MatchAllQueryParser.java
@@ -59,4 +59,9 @@ public class MatchAllQueryParser extends BaseQueryParser {
}
return queryBuilder;
}
+
+ @Override
+ public MatchAllQueryBuilder getBuilderPrototype() {
+ return MatchAllQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/MatchQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/MatchQueryBuilder.java
index 2459cf6591d..a2a0e5124d4 100644
--- a/src/main/java/org/elasticsearch/index/query/MatchQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/MatchQueryBuilder.java
@@ -94,6 +94,8 @@ public class MatchQueryBuilder extends QueryBuilder implements BoostableQueryBui
private String queryName;
+ static final MatchQueryBuilder PROTOTYPE = new MatchQueryBuilder(null, null);
+
/**
* Constructs a new text query.
*/
diff --git a/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java b/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java
index 805ff107c24..ddac7083c0a 100644
--- a/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java
@@ -178,4 +178,9 @@ public class MatchQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public MatchQueryBuilder getBuilderPrototype() {
+ return MatchQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/MissingQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/MissingQueryBuilder.java
index 9b6c1cdf857..a643110e8a4 100644
--- a/src/main/java/org/elasticsearch/index/query/MissingQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/MissingQueryBuilder.java
@@ -38,6 +38,8 @@ public class MissingQueryBuilder extends QueryBuilder {
private Boolean existence;
+ static final MissingQueryBuilder PROTOTYPE = new MissingQueryBuilder(null);
+
public MissingQueryBuilder(String name) {
this.name = name;
}
diff --git a/src/main/java/org/elasticsearch/index/query/MissingQueryParser.java b/src/main/java/org/elasticsearch/index/query/MissingQueryParser.java
index 548831f9fd3..e0a25f6b806 100644
--- a/src/main/java/org/elasticsearch/index/query/MissingQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/MissingQueryParser.java
@@ -172,4 +172,9 @@ public class MissingQueryParser extends BaseQueryParserTemp {
}
return new ConstantScoreQuery(filter);
}
+
+ @Override
+ public MissingQueryBuilder getBuilderPrototype() {
+ return MissingQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java
index f59c5b62027..209f6bc0edd 100644
--- a/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java
@@ -152,6 +152,8 @@ public class MoreLikeThisQueryBuilder extends QueryBuilder implements BoostableQ
private Boolean failOnUnsupportedField;
private String queryName;
+ static final MoreLikeThisQueryBuilder PROTOTYPE = new MoreLikeThisQueryBuilder();
+
/**
* Constructs a new more like this query which uses the "_all" field.
*/
diff --git a/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryParser.java b/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryParser.java
index 5122830c965..143cf610a6c 100644
--- a/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryParser.java
@@ -355,4 +355,9 @@ public class MoreLikeThisQueryParser extends BaseQueryParserTemp {
boolQuery.add(query, BooleanClause.Occur.MUST_NOT);
}
}
+
+ @Override
+ public MoreLikeThisQueryBuilder getBuilderPrototype() {
+ return MoreLikeThisQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java
index 1a3fe0ac52a..3113ec3292a 100644
--- a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryBuilder.java
@@ -80,6 +80,8 @@ public class MultiMatchQueryBuilder extends QueryBuilder implements BoostableQue
private String queryName;
+ static final MultiMatchQueryBuilder PROTOTYPE = new MultiMatchQueryBuilder(null);
+
public enum Type {
/**
diff --git a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java
index 5bbb777d091..0a4a05c6772 100644
--- a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java
@@ -197,4 +197,9 @@ public class MultiMatchQueryParser extends BaseQueryParserTemp {
fieldNameWithBoosts.put(fField, fBoost);
}
}
+
+ @Override
+ public MultiMatchQueryBuilder getBuilderPrototype() {
+ return MultiMatchQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/NestedQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/NestedQueryBuilder.java
index 50f7d5cd4bb..ab1252abadb 100644
--- a/src/main/java/org/elasticsearch/index/query/NestedQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/NestedQueryBuilder.java
@@ -41,10 +41,21 @@ public class NestedQueryBuilder extends QueryBuilder implements BoostableQueryBu
private QueryInnerHitBuilder innerHit;
+ static final NestedQueryBuilder PROTOTYPE = new NestedQueryBuilder();
+
public NestedQueryBuilder(String path, QueryBuilder queryBuilder) {
this.path = path;
this.queryBuilder = Objects.requireNonNull(queryBuilder);
}
+
+ /**
+ * private constructor only used internally
+ */
+ private NestedQueryBuilder() {
+ this.path = null;
+ this.queryBuilder = null;
+ }
+
/**
* The score mode.
*/
diff --git a/src/main/java/org/elasticsearch/index/query/NestedQueryParser.java b/src/main/java/org/elasticsearch/index/query/NestedQueryParser.java
index a353314c593..b0ced1c8f25 100644
--- a/src/main/java/org/elasticsearch/index/query/NestedQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/NestedQueryParser.java
@@ -161,4 +161,9 @@ public class NestedQueryParser extends BaseQueryParserTemp {
}
}
+
+ @Override
+ public NestedQueryBuilder getBuilderPrototype() {
+ return NestedQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/NotQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/NotQueryBuilder.java
index dd49c4cfa4c..37a9b324773 100644
--- a/src/main/java/org/elasticsearch/index/query/NotQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/NotQueryBuilder.java
@@ -35,10 +35,19 @@ public class NotQueryBuilder extends QueryBuilder {
private String queryName;
+ static final NotQueryBuilder PROTOTYPE = new NotQueryBuilder();
+
public NotQueryBuilder(QueryBuilder filter) {
this.filter = Objects.requireNonNull(filter);
}
+ /**
+ * private constructor for internal use
+ */
+ private NotQueryBuilder() {
+ this.filter = null;
+ }
+
public NotQueryBuilder queryName(String queryName) {
this.queryName = queryName;
return this;
diff --git a/src/main/java/org/elasticsearch/index/query/NotQueryParser.java b/src/main/java/org/elasticsearch/index/query/NotQueryParser.java
index 26b932d2bfd..c33b947fa43 100644
--- a/src/main/java/org/elasticsearch/index/query/NotQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/NotQueryParser.java
@@ -94,4 +94,9 @@ public class NotQueryParser extends BaseQueryParserTemp {
}
return notQuery;
}
+
+ @Override
+ public NotQueryBuilder getBuilderPrototype() {
+ return NotQueryBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/OrQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/OrQueryBuilder.java
index 53c9b968437..6f1cd30bd1f 100644
--- a/src/main/java/org/elasticsearch/index/query/OrQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/OrQueryBuilder.java
@@ -40,6 +40,8 @@ public class OrQueryBuilder extends QueryBuilder {
private String queryName;
+ static final OrQueryBuilder PROTOTYPE = new OrQueryBuilder();
+
public OrQueryBuilder(QueryBuilder... filters) {
Collections.addAll(this.filters, filters);
}
diff --git a/src/main/java/org/elasticsearch/index/query/OrQueryParser.java b/src/main/java/org/elasticsearch/index/query/OrQueryParser.java
index cad0828d5e2..e328ac81742 100644
--- a/src/main/java/org/elasticsearch/index/query/OrQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/OrQueryParser.java
@@ -112,4 +112,9 @@ public class OrQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public OrQueryBuilder getBuilderPrototype() {
+ return OrQueryBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/PrefixQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/PrefixQueryBuilder.java
index fee8273ded6..a048b54a0ac 100644
--- a/src/main/java/org/elasticsearch/index/query/PrefixQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/PrefixQueryBuilder.java
@@ -40,6 +40,8 @@ public class PrefixQueryBuilder extends MultiTermQueryBuilder implements Boostab
private String queryName;
+ static final PrefixQueryBuilder PROTOTYPE = new PrefixQueryBuilder(null, null);
+
/**
* A Query that matches documents containing terms with a specified prefix.
*
diff --git a/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java b/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java
index 7d34f649532..7d0cd296ee1 100644
--- a/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/PrefixQueryParser.java
@@ -115,4 +115,9 @@ public class PrefixQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public PrefixQueryBuilder getBuilderPrototype() {
+ return PrefixQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/QueryFilterBuilder.java b/src/main/java/org/elasticsearch/index/query/QueryFilterBuilder.java
index 715ba39d73a..bcce639103a 100644
--- a/src/main/java/org/elasticsearch/index/query/QueryFilterBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/QueryFilterBuilder.java
@@ -40,6 +40,8 @@ public class QueryFilterBuilder extends QueryBuilder {
private String queryName;
+ static final QueryFilterBuilder PROTOTYPE = new QueryFilterBuilder(null);
+
/**
* A filter that simply wraps a query.
*
diff --git a/src/main/java/org/elasticsearch/index/query/QueryFilterParser.java b/src/main/java/org/elasticsearch/index/query/QueryFilterParser.java
index a63491f2f04..387ae01254c 100644
--- a/src/main/java/org/elasticsearch/index/query/QueryFilterParser.java
+++ b/src/main/java/org/elasticsearch/index/query/QueryFilterParser.java
@@ -41,4 +41,9 @@ public class QueryFilterParser extends BaseQueryParserTemp {
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
return new ConstantScoreQuery(parseContext.parseInnerQuery());
}
+
+ @Override
+ public QueryFilterBuilder getBuilderPrototype() {
+ return QueryFilterBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/QueryParser.java b/src/main/java/org/elasticsearch/index/query/QueryParser.java
index 85f9570773e..b53fe861e83 100644
--- a/src/main/java/org/elasticsearch/index/query/QueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/QueryParser.java
@@ -59,4 +59,9 @@ public interface QueryParser {
* @throws QueryParsingException
*/
QueryBuilder fromXContent(QueryParseContext parseContext) throws IOException, QueryParsingException;
+
+ /**
+ * @return an empty {@link QueryBuilder} instance for this parser that can be used for deserialization
+ */
+ QueryBuilder getBuilderPrototype();
}
diff --git a/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java
index cf7d52ac95a..58323369c44 100644
--- a/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java
@@ -101,6 +101,8 @@ public class QueryStringQueryBuilder extends QueryBuilder implements BoostableQu
/** To limit effort spent determinizing regexp queries. */
private Integer maxDeterminizedStates;
+ static final QueryStringQueryBuilder PROTOTYPE = new QueryStringQueryBuilder(null);
+
public QueryStringQueryBuilder(String queryString) {
this.queryString = queryString;
}
diff --git a/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java b/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java
index 796862a3ed8..a6c527532f5 100644
--- a/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java
@@ -245,4 +245,9 @@ public class QueryStringQueryParser extends BaseQueryParserTemp {
throw new QueryParsingException(parseContext, "Failed to parse query [" + qpSettings.queryString() + "]", e);
}
}
+
+ @Override
+ public QueryStringQueryBuilder getBuilderPrototype() {
+ return QueryStringQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/RangeQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/RangeQueryBuilder.java
index d8b104f2b47..9c671fa2edc 100644
--- a/src/main/java/org/elasticsearch/index/query/RangeQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/RangeQueryBuilder.java
@@ -59,6 +59,8 @@ public class RangeQueryBuilder extends MultiTermQueryBuilder
private String format;
+ static final RangeQueryBuilder PROTOTYPE = new RangeQueryBuilder(null);
+
/**
* A Query that matches documents within an range of terms.
*
diff --git a/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java b/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java
index d6e1cda88a2..871bd82af53 100644
--- a/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java
@@ -19,12 +19,9 @@
package org.elasticsearch.index.query;
-import org.apache.lucene.search.TermRangeQuery;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.index.mapper.FieldMapper;
-import org.elasticsearch.index.mapper.core.DateFieldMapper;
import java.io.IOException;
@@ -125,4 +122,9 @@ public class RangeQueryParser extends BaseQueryParser {
rangeQuery.validate();
return rangeQuery;
}
+
+ @Override
+ public RangeQueryBuilder getBuilderPrototype() {
+ return RangeQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java
index c4d94db13a9..d273e1bc88e 100644
--- a/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java
@@ -39,6 +39,7 @@ public class RegexpQueryBuilder extends MultiTermQueryBuilder implements Boostab
private String queryName;
private int maxDeterminizedStates = Operations.DEFAULT_MAX_DETERMINIZED_STATES;
private boolean maxDetermizedStatesSet;
+ static final RegexpQueryBuilder PROTOTYPE = new RegexpQueryBuilder(null, null);
/**
* Constructs a new term query.
diff --git a/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java b/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java
index 7a0a1424d0b..36580a41f89 100644
--- a/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/RegexpQueryParser.java
@@ -124,5 +124,10 @@ public class RegexpQueryParser extends BaseQueryParserTemp {
return query;
}
+ @Override
+ public RegexpQueryBuilder getBuilderPrototype() {
+ return RegexpQueryBuilder.PROTOTYPE;
+ }
+
}
diff --git a/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java
index 9a1780801b7..41b09eab14b 100644
--- a/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java
@@ -38,6 +38,8 @@ public class ScriptQueryBuilder extends QueryBuilder {
private String queryName;
+ static final ScriptQueryBuilder PROTOTYPE = new ScriptQueryBuilder(null);
+
public ScriptQueryBuilder(String script) {
this.script = script;
}
diff --git a/src/main/java/org/elasticsearch/index/query/ScriptQueryParser.java b/src/main/java/org/elasticsearch/index/query/ScriptQueryParser.java
index b5835ae6255..3c275db2b3f 100644
--- a/src/main/java/org/elasticsearch/index/query/ScriptQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/ScriptQueryParser.java
@@ -189,4 +189,9 @@ public class ScriptQueryParser extends BaseQueryParserTemp {
};
}
}
+
+ @Override
+ public ScriptQueryBuilder getBuilderPrototype() {
+ return ScriptQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java
index 14f6edf92c8..0559a46c5d7 100644
--- a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java
@@ -43,6 +43,7 @@ public class SimpleQueryStringBuilder extends QueryBuilder {
private Boolean lenient;
private Boolean analyzeWildcard;
private Locale locale;
+ static final SimpleQueryStringBuilder PROTOTYPE = new SimpleQueryStringBuilder(null);
/**
* Operators for the default_operator
diff --git a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringParser.java b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringParser.java
index 021b3265917..bca98c517ab 100644
--- a/src/main/java/org/elasticsearch/index/query/SimpleQueryStringParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SimpleQueryStringParser.java
@@ -230,4 +230,9 @@ public class SimpleQueryStringParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SimpleQueryStringBuilder getBuilderPrototype() {
+ return SimpleQueryStringBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanContainingQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanContainingQueryBuilder.java
index 94ccc47df37..e870b33284f 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanContainingQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanContainingQueryBuilder.java
@@ -33,6 +33,7 @@ public class SpanContainingQueryBuilder extends QueryBuilder implements SpanQuer
private SpanQueryBuilder little;
private float boost = -1;
private String queryName;
+ static final SpanContainingQueryBuilder PROTOTYPE = new SpanContainingQueryBuilder();
/**
* Sets the little clause, it must be contained within {@code big} for a match.
diff --git a/src/main/java/org/elasticsearch/index/query/SpanContainingQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanContainingQueryParser.java
index bd24d25d056..fe534dc099a 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanContainingQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanContainingQueryParser.java
@@ -95,4 +95,9 @@ public class SpanContainingQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanContainingQueryBuilder getBuilderPrototype() {
+ return SpanContainingQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanFirstQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanFirstQueryBuilder.java
index 1f5bee4c871..2b551c0c7d1 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanFirstQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanFirstQueryBuilder.java
@@ -35,6 +35,8 @@ public class SpanFirstQueryBuilder extends QueryBuilder implements SpanQueryBuil
private String queryName;
+ static final SpanFirstQueryBuilder SPAN_FIRST_QUERY_BUILDER = new SpanFirstQueryBuilder(null, -1);
+
public SpanFirstQueryBuilder(SpanQueryBuilder matchBuilder, int end) {
this.matchBuilder = matchBuilder;
this.end = end;
diff --git a/src/main/java/org/elasticsearch/index/query/SpanFirstQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanFirstQueryParser.java
index 039b5b0bd4d..25b62f60e6f 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanFirstQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanFirstQueryParser.java
@@ -93,4 +93,9 @@ public class SpanFirstQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanFirstQueryBuilder getBuilderPrototype() {
+ return SpanFirstQueryBuilder.SPAN_FIRST_QUERY_BUILDER;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryBuilder.java
index 36fe9e75b49..6fec7732426 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryBuilder.java
@@ -26,6 +26,7 @@ public class SpanMultiTermQueryBuilder extends QueryBuilder implements SpanQuery
public static final String NAME = "span_multi";
private MultiTermQueryBuilder multiTermQueryBuilder;
+ static final SpanMultiTermQueryBuilder PROTOTYPE = new SpanMultiTermQueryBuilder(null);
public SpanMultiTermQueryBuilder(MultiTermQueryBuilder multiTermQueryBuilder) {
this.multiTermQueryBuilder = multiTermQueryBuilder;
diff --git a/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryParser.java
index af786f2f9d8..14841cb6df7 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanMultiTermQueryParser.java
@@ -66,4 +66,9 @@ public class SpanMultiTermQueryParser extends BaseQueryParserTemp {
parser.nextToken();
return new SpanMultiTermQueryWrapper<>((MultiTermQuery) subQuery);
}
+
+ @Override
+ public SpanMultiTermQueryBuilder getBuilderPrototype() {
+ return SpanMultiTermQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanNearQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanNearQueryBuilder.java
index 0cf4d688a4a..01003a794dc 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanNearQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanNearQueryBuilder.java
@@ -40,6 +40,8 @@ public class SpanNearQueryBuilder extends QueryBuilder implements SpanQueryBuild
private String queryName;
+ static final SpanNearQueryBuilder PROTOTYPE = new SpanNearQueryBuilder();
+
public SpanNearQueryBuilder clause(SpanQueryBuilder clause) {
clauses.add(clause);
return this;
diff --git a/src/main/java/org/elasticsearch/index/query/SpanNearQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanNearQueryParser.java
index 131d6a3cc35..4ec0c66bebb 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanNearQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanNearQueryParser.java
@@ -106,4 +106,9 @@ public class SpanNearQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanNearQueryBuilder getBuilderPrototype() {
+ return SpanNearQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanNotQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanNotQueryBuilder.java
index 96af6081519..ce32f798931 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanNotQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanNotQueryBuilder.java
@@ -41,6 +41,8 @@ public class SpanNotQueryBuilder extends QueryBuilder implements SpanQueryBuilde
private String queryName;
+ static final SpanNotQueryBuilder PROTOTYPE = new SpanNotQueryBuilder();
+
public SpanNotQueryBuilder include(SpanQueryBuilder include) {
this.include = include;
return this;
diff --git a/src/main/java/org/elasticsearch/index/query/SpanNotQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanNotQueryParser.java
index a094fe4cf0a..a92838c9af9 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanNotQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanNotQueryParser.java
@@ -126,4 +126,9 @@ public class SpanNotQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanNotQueryBuilder getBuilderPrototype() {
+ return SpanNotQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanOrQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanOrQueryBuilder.java
index dd15d3d95bc..6329d35b1d6 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanOrQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanOrQueryBuilder.java
@@ -34,6 +34,8 @@ public class SpanOrQueryBuilder extends QueryBuilder implements SpanQueryBuilder
private String queryName;
+ static final SpanOrQueryBuilder PROTOTYPE = new SpanOrQueryBuilder();
+
public SpanOrQueryBuilder clause(SpanQueryBuilder clause) {
clauses.add(clause);
return this;
diff --git a/src/main/java/org/elasticsearch/index/query/SpanOrQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanOrQueryParser.java
index 02e95a4876d..346004bfdf7 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanOrQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanOrQueryParser.java
@@ -92,4 +92,9 @@ public class SpanOrQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanOrQueryBuilder getBuilderPrototype() {
+ return SpanOrQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java
index a5b8fae105e..564ade46dca 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java
@@ -33,6 +33,7 @@ import org.elasticsearch.index.mapper.FieldMapper;
public class SpanTermQueryBuilder extends BaseTermQueryBuilder implements SpanQueryBuilder {
public static final String NAME = "span_term";
+ static final SpanTermQueryBuilder PROTOTYPE = new SpanTermQueryBuilder(null, null);
/** @see BaseTermQueryBuilder#BaseTermQueryBuilder(String, String) */
public SpanTermQueryBuilder(String name, String value) {
diff --git a/src/main/java/org/elasticsearch/index/query/SpanTermQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanTermQueryParser.java
index 1db80255806..4302d61832d 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanTermQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanTermQueryParser.java
@@ -92,4 +92,9 @@ public class SpanTermQueryParser extends BaseQueryParser {
result.validate();
return result;
}
+
+ @Override
+ public SpanTermQueryBuilder getBuilderPrototype() {
+ return SpanTermQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/SpanWithinQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/SpanWithinQueryBuilder.java
index b98bc86286b..bca469c0a15 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanWithinQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanWithinQueryBuilder.java
@@ -33,6 +33,7 @@ public class SpanWithinQueryBuilder extends QueryBuilder implements SpanQueryBui
private SpanQueryBuilder little;
private float boost = -1;
private String queryName;
+ static final SpanWithinQueryBuilder PROTOTYPE = new SpanWithinQueryBuilder();
/**
* Sets the little clause, it must be contained within {@code big} for a match.
diff --git a/src/main/java/org/elasticsearch/index/query/SpanWithinQueryParser.java b/src/main/java/org/elasticsearch/index/query/SpanWithinQueryParser.java
index 73c4bb653d5..7762c76a963 100644
--- a/src/main/java/org/elasticsearch/index/query/SpanWithinQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/SpanWithinQueryParser.java
@@ -95,4 +95,9 @@ public class SpanWithinQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public SpanWithinQueryBuilder getBuilderPrototype() {
+ return SpanWithinQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/TemplateQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/TemplateQueryBuilder.java
index 1e40f0ef83e..0ec55907a1e 100644
--- a/src/main/java/org/elasticsearch/index/query/TemplateQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/TemplateQueryBuilder.java
@@ -39,6 +39,8 @@ public class TemplateQueryBuilder extends QueryBuilder {
private ScriptService.ScriptType templateType;
+ static final TemplateQueryBuilder PROTOTYPE = new TemplateQueryBuilder(null, null);
+
/**
* @param template the template to use for that query.
* @param vars the parameters to fill the template with.
diff --git a/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java b/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java
index 51dc82cfbe1..d2fbb3140ae 100644
--- a/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/TemplateQueryParser.java
@@ -155,4 +155,9 @@ public class TemplateQueryParser extends BaseQueryParserTemp {
return type + " " + template;
}
}
+
+ @Override
+ public TemplateQueryBuilder getBuilderPrototype() {
+ return TemplateQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java
index 6bb3cffa8b2..54aff40ab3b 100644
--- a/src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java
@@ -31,6 +31,7 @@ import org.elasticsearch.index.mapper.FieldMapper;
public class TermQueryBuilder extends BaseTermQueryBuilder implements BoostableQueryBuilder {
public static final String NAME = "term";
+ static final TermQueryBuilder PROTOTYPE = new TermQueryBuilder(null, null);
/** @see BaseTermQueryBuilder#BaseTermQueryBuilder(String, String) */
public TermQueryBuilder(String fieldName, String value) {
diff --git a/src/main/java/org/elasticsearch/index/query/TermQueryParser.java b/src/main/java/org/elasticsearch/index/query/TermQueryParser.java
index 13da986520e..31d1a22f4c4 100644
--- a/src/main/java/org/elasticsearch/index/query/TermQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/TermQueryParser.java
@@ -19,7 +19,6 @@
package org.elasticsearch.index.query;
-import org.apache.lucene.search.TermQuery;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.xcontent.XContentParser;
@@ -96,4 +95,9 @@ public class TermQueryParser extends BaseQueryParser {
termQuery.validate();
return termQuery;
}
+
+ @Override
+ public TermQueryBuilder getBuilderPrototype() {
+ return TermQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java
index 908bff80d56..63fba5aa9d9 100644
--- a/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java
@@ -45,6 +45,8 @@ public class TermsQueryBuilder extends QueryBuilder {
private String lookupPath;
private Boolean lookupCache;
+ static final TermsQueryBuilder PROTOTYPE = new TermsQueryBuilder(null, (Object) null);
+
/**
* A filter for a field based on several terms matching on any of them.
*
diff --git a/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java b/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java
index 4d587b70bd6..4dfe46f11ab 100644
--- a/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/TermsQueryParser.java
@@ -207,4 +207,9 @@ public class TermsQueryParser extends BaseQueryParserTemp {
}
return query;
}
+
+ @Override
+ public TermsQueryBuilder getBuilderPrototype() {
+ return TermsQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java
index 667ae35b6e8..444318fd95b 100644
--- a/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java
@@ -27,6 +27,7 @@ public class TypeQueryBuilder extends QueryBuilder {
public static final String NAME = "type";
private final String type;
+ static final TypeQueryBuilder PROTOTYPE = new TypeQueryBuilder(null);
public TypeQueryBuilder(String type) {
this.type = type;
diff --git a/src/main/java/org/elasticsearch/index/query/TypeQueryParser.java b/src/main/java/org/elasticsearch/index/query/TypeQueryParser.java
index 0f0630ad3fc..979a712da6e 100644
--- a/src/main/java/org/elasticsearch/index/query/TypeQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/TypeQueryParser.java
@@ -62,7 +62,7 @@ public class TypeQueryParser extends BaseQueryParserTemp {
parser.nextToken();
Query filter;
- //LUCENE 4 UPGRADE document mapper should use bytesref as well?
+ //LUCENE 4 UPGRADE document mapper should use bytesref as well?
DocumentMapper documentMapper = parseContext.mapperService().documentMapper(type.utf8ToString());
if (documentMapper == null) {
filter = new TermQuery(new Term(TypeFieldMapper.NAME, type));
@@ -71,4 +71,9 @@ public class TypeQueryParser extends BaseQueryParserTemp {
}
return filter;
}
+
+ @Override
+ public TypeQueryBuilder getBuilderPrototype() {
+ return TypeQueryBuilder.PROTOTYPE;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java
index 13ab05e04b0..2e8a2cb7187 100644
--- a/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java
@@ -45,6 +45,8 @@ public class WildcardQueryBuilder extends MultiTermQueryBuilder implements Boost
private String queryName;
+ static final WildcardQueryBuilder PROTOTYPE = new WildcardQueryBuilder(null, null);
+
/**
* Implements the wildcard search query. Supported wildcards are *, which
* matches any character sequence (including the empty one), and ?,
diff --git a/src/main/java/org/elasticsearch/index/query/WildcardQueryParser.java b/src/main/java/org/elasticsearch/index/query/WildcardQueryParser.java
index 9dd587b4a34..7de1fd28364 100644
--- a/src/main/java/org/elasticsearch/index/query/WildcardQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/WildcardQueryParser.java
@@ -108,4 +108,9 @@ public class WildcardQueryParser extends BaseQueryParserTemp {
}
return wildcardQuery;
}
+
+ @Override
+ public WildcardQueryBuilder getBuilderPrototype() {
+ return WildcardQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/WrapperQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/WrapperQueryBuilder.java
index 6b8a2c4977b..1461eb999ca 100644
--- a/src/main/java/org/elasticsearch/index/query/WrapperQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/WrapperQueryBuilder.java
@@ -46,6 +46,7 @@ public class WrapperQueryBuilder extends QueryBuilder {
private final byte[] source;
private final int offset;
private final int length;
+ static final WrapperQueryBuilder PROTOTYPE = new WrapperQueryBuilder(null, -1, -1);
/**
* Creates a query builder given a query provided as a string
diff --git a/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java b/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java
index 9a1454292b0..3d5c0ab0630 100644
--- a/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/WrapperQueryParser.java
@@ -64,4 +64,9 @@ public class WrapperQueryParser extends BaseQueryParserTemp {
return result;
}
}
+
+ @Override
+ public WrapperQueryBuilder getBuilderPrototype() {
+ return WrapperQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java
index 9ca5ea4ad54..c59ca4056b9 100644
--- a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java
+++ b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryBuilder.java
@@ -49,6 +49,8 @@ public class FunctionScoreQueryBuilder extends QueryBuilder implements Boostable
private ArrayList scoreFunctions = new ArrayList<>();
private Float minScore = null;
+ static final FunctionScoreQueryBuilder PROTOTYPE = new FunctionScoreQueryBuilder();
+
/**
* Creates a function_score query that executes on documents that match query a query.
* Query and filter will be wrapped into a filtered_query.
diff --git a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java
index 86684cada8d..4c05d4db904 100644
--- a/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java
+++ b/src/main/java/org/elasticsearch/index/query/functionscore/FunctionScoreQueryParser.java
@@ -277,4 +277,9 @@ public class FunctionScoreQueryParser implements QueryParser {
Query query = parse(parseContext);
return new QueryWrappingQueryBuilder(query);
}
+
+ @Override
+ public FunctionScoreQueryBuilder getBuilderPrototype() {
+ return FunctionScoreQueryBuilder.PROTOTYPE;
+ }
}
diff --git a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java
index 28dc0f85bc9..f0f1df886eb 100644
--- a/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java
+++ b/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java
@@ -191,6 +191,11 @@ public class SimpleIndexQueryParserTests extends ElasticsearchSingleNodeTest {
assertEquals(XContentParser.Token.END_OBJECT, parseContext.parser().nextToken());
return new DummyQueryBuilder();
}
+
+ @Override
+ public DummyQueryBuilder getBuilderPrototype() {
+ return new DummyQueryBuilder();
+ }
}
private static class DummyQueryBuilder extends QueryBuilder {
diff --git a/src/test/java/org/elasticsearch/index/query/guice/MyJsonQueryParser.java b/src/test/java/org/elasticsearch/index/query/guice/MyJsonQueryParser.java
index 89c203835fc..13e99f3eff1 100644
--- a/src/test/java/org/elasticsearch/index/query/guice/MyJsonQueryParser.java
+++ b/src/test/java/org/elasticsearch/index/query/guice/MyJsonQueryParser.java
@@ -69,4 +69,9 @@ public class MyJsonQueryParser extends AbstractIndexComponent implements QueryPa
Query query = parse(parseContext);
return new QueryWrappingQueryBuilder(query);
}
+
+ @Override
+ public QueryBuilder getBuilderPrototype() {
+ throw new UnsupportedOperationException("Not implemented in test class");
+ }
}
diff --git a/src/test/java/org/elasticsearch/index/query/plugin/PluginJsonQueryParser.java b/src/test/java/org/elasticsearch/index/query/plugin/PluginJsonQueryParser.java
index d67fc7c72cc..fdf1be4e9f5 100644
--- a/src/test/java/org/elasticsearch/index/query/plugin/PluginJsonQueryParser.java
+++ b/src/test/java/org/elasticsearch/index/query/plugin/PluginJsonQueryParser.java
@@ -69,4 +69,9 @@ public class PluginJsonQueryParser extends AbstractIndexComponent implements Que
Query query = parse(parseContext);
return new QueryWrappingQueryBuilder(query);
}
+
+ @Override
+ public QueryBuilder getBuilderPrototype() {
+ throw new UnsupportedOperationException("Not implemented in test class");
+ }
}
\ No newline at end of file