FacetWP – only index certain facets

<?php

add_filter( 'facetwp_indexer_post_facet', function( $return, $params ) {
    $included_facets = array( 'categories', 'price' );
    if ( in_array( $params['facet']['name'], $included_facets ) ) {
        return $return;
    }
    return true; // skip indexing
}, 10, 2 );