We need to add track_total_hits: true to appropriate queries and adapt the code to retrieve the totalHits value. This means we need to switch over all the places where we use rest_total_hits_as_int to use track_total_hits, considering whether we need to use the exact hits total, or just an estimate.
More details: https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html#hits-total-now-object-search-response