]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11792 remove use of deprecated nested_path and nested_filter
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 14 Mar 2019 16:27:24 +0000 (17:27 +0100)
committerSonarTech <sonartech@sonarsource.com>
Tue, 19 Mar 2019 19:21:26 +0000 (20:21 +0100)
server/sonar-server/src/main/java/org/sonar/server/measure/index/ProjectMeasuresIndex.java

index 2323fb87ddc658d6545156f730d25f281fec5996..2fd1727b64677796a3443301b16924372c03e055 100644 (file)
@@ -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));
   }