facetwp index only parents

<?php
/** 
 ** index only top level parents in a hierarchal taxonomy
 **/

add_filter( 'facetwp_index_row', function( $params, $class ) {
	if ( 'my_facet' == $params['facet_name'] ) { // change my_facet to the name of your facet
		if ( !empty( $params['parent_id'] ) ) {
			$params['facet_value'] = '';
		}
	}
	return $params;
}, 10, 2 );