select r.id, e.*
from records r
cross join lateral jsonb_array_elements(r.data -> 'entries') as e
where e ->> 'name' like '%Doe%';
select r.*
from records r
where exists (select 1
from jsonb_array_elements(r.data -> 'entries') as e
where e ->> 'name' like '%Doe%');