From: Sébastien Lesaint Date: Thu, 14 Mar 2019 16:27:24 +0000 (+0100) Subject: SONAR-11792 remove use of deprecated nested_path and nested_filter X-Git-Tag: 7.7~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2886938c6365bf627108b7427fae1dd7d9f7a47e;p=sonarqube.git SONAR-11792 remove use of deprecated nested_path and nested_filter --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/index/ProjectMeasuresIndex.java b/server/sonar-server/src/main/java/org/sonar/server/measure/index/ProjectMeasuresIndex.java index 2323fb87ddc..2fd1727b646 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/index/ProjectMeasuresIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/index/ProjectMeasuresIndex.java @@ -49,14 +49,15 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.sum.Sum; import org.elasticsearch.search.sort.FieldSortBuilder; +import org.elasticsearch.search.sort.NestedSortBuilder; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.System2; import org.sonar.core.util.stream.MoreCollectors; -import org.sonar.server.es.newindex.DefaultIndexSettingsElement; import org.sonar.server.es.EsClient; import org.sonar.server.es.SearchIdResult; import org.sonar.server.es.SearchOptions; import org.sonar.server.es.StickyFacetBuilder; +import org.sonar.server.es.newindex.DefaultIndexSettingsElement; import org.sonar.server.measure.index.ProjectMeasuresQuery.MetricCriterion; import org.sonar.server.permission.index.WebAuthorizationTypeSupport; @@ -250,8 +251,9 @@ public class ProjectMeasuresIndex { private static void addMetricSort(ProjectMeasuresQuery query, SearchRequestBuilder requestBuilder, String sort) { requestBuilder.addSort( new FieldSortBuilder(FIELD_MEASURES_VALUE) - .setNestedPath(FIELD_MEASURES) - .setNestedFilter(termQuery(FIELD_MEASURES_KEY, sort)) + .setNestedSort( + new NestedSortBuilder(FIELD_MEASURES) + .setFilter(termQuery(FIELD_MEASURES_KEY, sort))) .order(query.isAsc() ? ASC : DESC)); }