Index ACF map sub fields other than lat and lng

<?php
/**
 ** Facet automatically indexes latitude and longitude from an ACF map field
 ** This will index other data saved in other sub fields
 ** Note that these fields are optional and may not exist
 ** See ACF docs for more - https://www.advancedcustomfields.com/resources/google-map/#template-usage
 **/

add_filter( 'facetwp_index_row', function( $params, $class ) {
	if ( 'my_facet' == $params['facet_name'] ) { // change my_facet to name of your facet
		$post_id = $params['post_id'];
		$acf = str_replace( 'acf/', '', $params['facet_source'] );
		$location = get_field( $acf, $post_id );
		$value = $location['city'] ?? ''; 
		if ( '' != $value ) {
			$params['facet_value'] = $value;
			$params['facet_display_value'] = $value;
		} else {
			$params['facet_value'] = ''; // don't index
		}
	}
	return $params;
}, 10, 2 );