diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TextQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TextQueryBuilder.java index c88f653d273..eb460569875 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TextQueryBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TextQueryBuilder.java @@ -59,6 +59,8 @@ public class TextQueryBuilder extends BaseQueryBuilder { private String analyzer; + private Float boost; + private Integer slop; private String fuzziness; @@ -100,6 +102,14 @@ public class TextQueryBuilder extends BaseQueryBuilder { return this; } + /** + * Set the boost to apply to the query. + */ + public TextQueryBuilder boost(float boost) { + this.boost = boost; + return this; + } + /** * Set the phrase slop if evaluated to a phrase query type. */ @@ -139,6 +149,9 @@ public class TextQueryBuilder extends BaseQueryBuilder { if (analyzer != null) { builder.field("analyzer", analyzer); } + if (boost != null) { + builder.field("boost", boost); + } if (slop != null) { builder.field("slop", slop); }