diff --git a/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java b/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java index 88474292dc4..fd4b95487b9 100644 --- a/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/HasChildQueryParser.java @@ -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 { diff --git a/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java b/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java index f7927df53f9..de8b33bbbeb 100644 --- a/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/HasParentQueryParser.java @@ -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 { diff --git a/src/main/java/org/elasticsearch/index/query/TopChildrenQueryParser.java b/src/main/java/org/elasticsearch/index/query/TopChildrenQueryParser.java index fa33b9cb31b..ff2c98c0bb6 100644 --- a/src/main/java/org/elasticsearch/index/query/TopChildrenQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/TopChildrenQueryParser.java @@ -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)) { diff --git a/src/main/java/org/elasticsearch/index/search/child/ScoreType.java b/src/main/java/org/elasticsearch/index/search/child/ScoreType.java index 568c2f960d0..5938bc5d7d8 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ScoreType.java +++ b/src/main/java/org/elasticsearch/index/search/child/ScoreType.java @@ -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"); }