diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
index 13009f0c3da..b6549de9562 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java
@@ -65,8 +65,7 @@ public class MoreLikeThisRequest implements ActionRequest {
private int maxDocFreq = -1;
private int minWordLen = -1;
private int maxWordLen = -1;
- private Boolean boostTerms = null;
- private float boostTermsFactor = -1;
+ private float boostTerms = -1;
private SearchType searchType = SearchType.DEFAULT;
private String searchQueryHint;
@@ -282,35 +281,20 @@ public class MoreLikeThisRequest implements ActionRequest {
}
/**
- * Whether to boost terms in query based on "score" or not. Defaults to false.
+ * The boost factor to use when boosting terms. Defaults to 1.
*/
- public MoreLikeThisRequest boostTerms(Boolean boostTerms) {
+ public MoreLikeThisRequest boostTerms(float boostTerms) {
this.boostTerms = boostTerms;
return this;
}
/**
- * Whether to boost terms in query based on "score" or not. Defaults to false.
+ * The boost factor to use when boosting terms. Defaults to 1.
*/
- public Boolean boostTerms() {
+ public float boostTerms() {
return this.boostTerms;
}
- /**
- * The boost factor to use when boosting terms. Defaults to 1.
- */
- public MoreLikeThisRequest boostTermsFactor(float boostTermsFactor) {
- this.boostTermsFactor = boostTermsFactor;
- return this;
- }
-
- /**
- * The boost factor to use when boosting terms. Defaults to 1.
- */
- public float boostTermsFactor() {
- return this.boostTermsFactor;
- }
-
/**
* An optional search source request allowing to control the search request for the
* more like this documents.
@@ -483,10 +467,7 @@ public class MoreLikeThisRequest implements ActionRequest {
maxDocFreq = in.readVInt();
minWordLen = in.readVInt();
maxWordLen = in.readVInt();
- if (in.readBoolean()) {
- boostTerms = in.readBoolean();
- }
- boostTermsFactor = in.readFloat();
+ boostTerms = in.readFloat();
searchType = SearchType.fromId(in.readByte());
if (in.readBoolean()) {
searchQueryHint = in.readUTF();
@@ -553,13 +534,7 @@ public class MoreLikeThisRequest implements ActionRequest {
out.writeVInt(maxDocFreq);
out.writeVInt(minWordLen);
out.writeVInt(maxWordLen);
- if (boostTerms == null) {
- out.writeBoolean(false);
- } else {
- out.writeBoolean(true);
- out.writeBoolean(boostTerms);
- }
- out.writeFloat(boostTermsFactor);
+ out.writeFloat(boostTerms);
out.writeByte(searchType.id());
if (searchQueryHint == null) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/TransportMoreLikeThisAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/TransportMoreLikeThisAction.java
index 6ebd1f50666..905e5b692cb 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/TransportMoreLikeThisAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/mlt/TransportMoreLikeThisAction.java
@@ -222,7 +222,6 @@ public class TransportMoreLikeThisAction extends BaseActionfalse.
- */
- public MoreLikeThisFieldJsonQueryBuilder boostTerms(Boolean boostTerms) {
- this.boostTerms = boostTerms;
- return this;
- }
-
/**
* Sets the boost factor to use when boosting terms. Defaults to 1.
*/
- public MoreLikeThisFieldJsonQueryBuilder boostTermsFactor(float boostTermsFactor) {
- this.boostTermsFactor = boostTermsFactor;
+ public MoreLikeThisFieldJsonQueryBuilder boostTerms(float boostTerms) {
+ this.boostTerms = boostTerms;
return this;
}
@@ -194,12 +184,9 @@ public class MoreLikeThisFieldJsonQueryBuilder extends BaseJsonQueryBuilder {
if (maxWordLen != -1) {
builder.field("max_word_len", maxWordLen);
}
- if (boostTerms != null) {
+ if (boostTerms != -1) {
builder.field("boost_terms", boostTerms);
}
- if (boostTermsFactor != -1) {
- builder.field("boost_terms_factor", boostTermsFactor);
- }
if (boost != -1) {
builder.field("boost", boost);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java
index 6fc669bed47..70a1b955add 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java
@@ -28,7 +28,6 @@ import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.query.QueryParsingException;
import org.elasticsearch.index.settings.IndexSettings;
-import org.elasticsearch.util.Booleans;
import org.elasticsearch.util.lucene.search.MoreLikeThisQuery;
import org.elasticsearch.util.settings.Settings;
@@ -87,8 +86,7 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp
} else if ("max_word_len".equals(currentFieldName)) {
mltQuery.setMaxWordLen(Integer.parseInt(jp.getText()));
} else if ("boost_terms".equals(currentFieldName)) {
- mltQuery.setBoostTerms(Booleans.parseBoolean(jp.getText(), false));
- } else if ("boost_terms_factor".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(Float.parseFloat(jp.getText()));
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(Float.parseFloat(jp.getText()));
@@ -106,9 +104,8 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp
mltQuery.setMinWordLen(jp.getIntValue());
} else if ("max_word_len".equals(currentFieldName)) {
mltQuery.setMaxWordLen(jp.getIntValue());
- } else if ("boost_terms".equals(currentFieldName)) {
- mltQuery.setBoostTerms(jp.getIntValue() != 0);
- } else if ("boost_term_factor".equals(currentFieldName)) {
+ } else if ("boost_term".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(jp.getIntValue());
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(jp.getIntValue());
@@ -116,7 +113,8 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp
mltQuery.setBoost(jp.getIntValue());
}
} else if (token == JsonToken.VALUE_NUMBER_FLOAT) {
- if ("boost_terms_factor".equals(currentFieldName)) {
+ if ("boost_terms".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(jp.getFloatValue());
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(jp.getFloatValue());
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java
index f23ea9ffa3c..19f90b6d1bf 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java
@@ -43,8 +43,7 @@ public class MoreLikeThisJsonQueryBuilder extends BaseJsonQueryBuilder {
private int maxDocFreq = -1;
private int minWordLen = -1;
private int maxWordLen = -1;
- private Boolean boostTerms = null;
- private float boostTermsFactor = -1;
+ private float boostTerms = -1;
private float boost = -1;
/**
@@ -145,20 +144,11 @@ public class MoreLikeThisJsonQueryBuilder extends BaseJsonQueryBuilder {
return this;
}
- /**
- * Sets whether to boost terms in query based on "score" or not. Defaults to
- * false.
- */
- public MoreLikeThisJsonQueryBuilder boostTerms(boolean boostTerms) {
- this.boostTerms = boostTerms;
- return this;
- }
-
/**
* Sets the boost factor to use when boosting terms. Defaults to 1.
*/
- public MoreLikeThisJsonQueryBuilder boostTermsFactor(float boostTermsFactor) {
- this.boostTermsFactor = boostTermsFactor;
+ public MoreLikeThisJsonQueryBuilder boostTerms(float boostTerms) {
+ this.boostTerms = boostTerms;
return this;
}
@@ -208,12 +198,9 @@ public class MoreLikeThisJsonQueryBuilder extends BaseJsonQueryBuilder {
if (maxWordLen != -1) {
builder.field("max_word_len", maxWordLen);
}
- if (boostTerms != null) {
+ if (boostTerms != -1) {
builder.field("boost_terms", boostTerms);
}
- if (boostTermsFactor != -1) {
- builder.field("boost_terms_factor", boostTermsFactor);
- }
if (boost != -1) {
builder.field("boost", boost);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java
index 33e473e583a..c1b0d89c536 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java
@@ -28,7 +28,6 @@ import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.AllFieldMapper;
import org.elasticsearch.index.query.QueryParsingException;
import org.elasticsearch.index.settings.IndexSettings;
-import org.elasticsearch.util.Booleans;
import org.elasticsearch.util.lucene.search.MoreLikeThisQuery;
import org.elasticsearch.util.settings.Settings;
@@ -81,8 +80,7 @@ public class MoreLikeThisJsonQueryParser extends AbstractIndexComponent implemen
} else if ("max_word_len".equals(currentFieldName)) {
mltQuery.setMaxWordLen(Integer.parseInt(jp.getText()));
} else if ("boost_terms".equals(currentFieldName)) {
- mltQuery.setBoostTerms(Booleans.parseBoolean(jp.getText(), false));
- } else if ("boost_terms_factor".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(Float.parseFloat(jp.getText()));
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(Float.parseFloat(jp.getText()));
@@ -101,8 +99,7 @@ public class MoreLikeThisJsonQueryParser extends AbstractIndexComponent implemen
} else if ("max_word_len".equals(currentFieldName)) {
mltQuery.setMaxWordLen(jp.getIntValue());
} else if ("boost_terms".equals(currentFieldName)) {
- mltQuery.setBoostTerms(jp.getIntValue() != 0);
- } else if ("boost_terms_factor".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(jp.getIntValue());
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(jp.getIntValue());
@@ -110,7 +107,8 @@ public class MoreLikeThisJsonQueryParser extends AbstractIndexComponent implemen
mltQuery.setBoost(jp.getIntValue());
}
} else if (token == JsonToken.VALUE_NUMBER_FLOAT) {
- if ("boost_terms_factor".equals(currentFieldName)) {
+ if ("boost_terms".equals(currentFieldName)) {
+ mltQuery.setBoostTerms(true);
mltQuery.setBoostTermsFactor(jp.getFloatValue());
} else if ("percent_terms_to_match".equals(currentFieldName)) {
mltQuery.setPercentTermsToMatch(jp.getFloatValue());
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
index da4e9cc367c..e018a418bfa 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java
@@ -61,8 +61,7 @@ public class RestMoreLikeThisAction extends BaseRestHandler {
mltRequest.maxDocFreq(request.paramAsInt("max_doc_freq", -1));
mltRequest.minWordLen(request.paramAsInt("min_word_len", -1));
mltRequest.maxWordLen(request.paramAsInt("max_word_len", -1));
- mltRequest.boostTerms(request.paramAsBoolean("boost_terms", null));
- mltRequest.boostTermsFactor(request.paramAsFloat("boost_terms_factor", -1));
+ mltRequest.boostTerms(request.paramAsFloat("boost_terms", -1));
mltRequest.searchType(parseSearchType(request.param("search_type")));
mltRequest.searchIndices(request.paramAsStringArray("search_indices", null));