Hi Pedro.
Please use the following code:
add_filter('generate_element_display', function($display, $element_id) {
// Replace 123 with the actual Element ID
if ($element_id === 123 && is_search()) {
return false; // Don't display on search results
}
return $display;
}, 10, 2);
Replace 123 with your element ID and just have the condition to appear in the Search Results page, no need for any exclude conditions.
Let me know how it goes.