def METHOD_NAME(return_fields, scope, search_text, country, state, limit):
    query = create_es_search(scope, search_text, country, state)
    # Buffering the "group by city" to create a handful more buckets, more than the number of shards we expect to have,
    # so that we don't get inconsistent results when the limit gets down to a very low number (e.g. lower than the
    # number of shards we have) such that it may provide inconsistent results in repeated queries
    city_buckets = limit + 100
    if country != "USA":
        aggs = {"field": return_fields[2], "size": 100}
    else:
        aggs = {"field": return_fields[1], "size": 100}
    agg_values = {"field": "{}.keyword".format(return_fields[0]), "size": city_buckets}
    agg_key = A("terms", **agg_values)
    query.aggs.bucket("cities", agg_key).bucket("states", A("terms", **aggs))
    return query