diff --git a/core/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java index 4fe83a1a890..3887874ee94 100644 --- a/core/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/GeoShapeQueryBuilder.java @@ -29,7 +29,7 @@ import java.io.IOException; /** * {@link QueryBuilder} that builds a GeoShape Filter */ -public class GeoShapeQueryBuilder extends QueryBuilder { +public class GeoShapeQueryBuilder extends QueryBuilder implements BoostableQueryBuilder { private final String name; @@ -46,6 +46,8 @@ public class GeoShapeQueryBuilder extends QueryBuilder { private String indexedShapePath; private ShapeRelation relation = null; + + private float boost = -1; /** * Creates a new GeoShapeQueryBuilder whose Filter will be against the @@ -146,6 +148,12 @@ public class GeoShapeQueryBuilder extends QueryBuilder { return this; } + @Override + public GeoShapeQueryBuilder boost(float boost) { + this.boost = boost; + return this; + } + @Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(GeoShapeQueryParser.NAME); @@ -177,6 +185,10 @@ public class GeoShapeQueryBuilder extends QueryBuilder { builder.endObject(); + if (boost != -1) { + builder.field("boost", boost); + } + if (name != null) { builder.field("_name", queryName); }