Elementor Custom Query to get Posts by ACF (Post Object Field

Reference Link: https://developers.elementor.com/custom-query-filter/#Using_the_Custom_Filter

arbitrary_name_query_id – the QUERY ID that you fill in the Elementor field,

the code to be placed within functions.php:

add_action( 'elementor/query/arbitrary_name_query_id', function( $query ) {
    $meta_query = $query->get( 'meta_query' ); 
    $meta_query[] = [ 
        'key' => 'acf_key', // put ACF relationship field name 
        'value' => get_the_ID(), 
        'compare' => '=', 
    ]; 
    $query->set( 'meta_query', $meta_query );
    $query->set( 'post_type', 'post_type' ); // put post type name 
});