separate get/update logic in ESWrite app_totals
add explicit test for get_app_totals