Made all the queries support `score_mode` parameter name in addition to the existing parameter name for score mode.
Closes #3026
This commit is contained in:
parent
bacf969dd3
commit
6eaad25621
|
@ -89,6 +89,11 @@ public class HasChildQueryParser implements QueryParser {
|
|||
if (!"none".equals(scoreTypeValue)) {
|
||||
scoreType = ScoreType.fromString(scoreTypeValue);
|
||||
}
|
||||
} else if ("score_mode".equals(currentFieldName) || "scoreMode".equals(currentFieldName)) {
|
||||
String scoreModeValue = parser.text();
|
||||
if (!"none".equals(scoreModeValue)) {
|
||||
scoreType = ScoreType.fromString(scoreModeValue);
|
||||
}
|
||||
} else if ("boost".equals(currentFieldName)) {
|
||||
boost = parser.floatValue();
|
||||
} else {
|
||||
|
|
|
@ -92,6 +92,13 @@ public class HasParentQueryParser implements QueryParser {
|
|||
} else if ("none".equals(scoreTypeValue)) {
|
||||
score = false;
|
||||
}
|
||||
} else if ("score_mode".equals(currentFieldName) || "scoreMode".equals(currentFieldName)) {
|
||||
String scoreModeValue = parser.text();
|
||||
if ("score".equals(scoreModeValue)) {
|
||||
score = true;
|
||||
} else if ("none".equals(scoreModeValue)) {
|
||||
score = false;
|
||||
}
|
||||
} else if ("boost".equals(currentFieldName)) {
|
||||
boost = parser.floatValue();
|
||||
} else {
|
||||
|
|
|
@ -86,6 +86,8 @@ public class TopChildrenQueryParser implements QueryParser {
|
|||
throw new QueryParsingException(parseContext.index(), "the [_scope] support in [top_children] query has been removed, use a filter as a facet_filter in the relevant global facet");
|
||||
} else if ("score".equals(currentFieldName)) {
|
||||
scoreType = ScoreType.fromString(parser.text());
|
||||
} else if ("score_mode".equals(currentFieldName) || "scoreMode".equals(currentFieldName)) {
|
||||
scoreType = ScoreType.fromString(parser.text());
|
||||
} else if ("boost".equals(currentFieldName)) {
|
||||
boost = parser.floatValue();
|
||||
} else if ("factor".equals(currentFieldName)) {
|
||||
|
|
|
@ -48,6 +48,8 @@ public enum ScoreType {
|
|||
return AVG;
|
||||
} else if ("sum".equals(type)) {
|
||||
return SUM;
|
||||
} else if ("total".equals(type)) { // This name is consistent with: ScoreMode.Total
|
||||
return SUM;
|
||||
}
|
||||
throw new ElasticSearchIllegalArgumentException("No score type for child query [" + type + "] found");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue