private void setDegradation(Query query) {
        query.trace("Using sorting degrading for performance - totalHits will be wrong. " + 
                    "Turn off with sorting.degrading=false.", 2);
        Sorting.FieldOrder primarySort = query.getRanking().getSorting().fieldOrders().get(0); // ensured above
        MatchPhase matchPhase = query.getRanking().getMatchPhase();

        matchPhase.setAttribute(primarySort.getFieldName());
        matchPhase.setAscending(primarySort.getSortOrder() == Sorting.Order.ASCENDING);
        if (matchPhase.getMaxHits() == null)
            matchPhase.setMaxHits(decideDefaultMaxHits(query));
    }
Set this to false in query.properties to turn off degrading. Default: on
container-search/src/main/java/com/yahoo/search/querytransform/SortingDegrader.java