How to list all nodes attached to a vocabulary?
Are you sure that you are using the tags field for this?

You're filtering on the term name, but you want to filter on the term vid instead:

 $query = \Drupal::entityQuery('node')
  -&gt;condition('type', 'health_posts')
  -&gt;condition('status', 1)
  -&gt;condition('field_tags.entity.vid', 'healthcare_terms');
$ids = $query-&gt;execute();


If you have a standalone field that only allows terms from your healthcare_terms vocabulary, which is usually the better approach, then you can just look for ->exists('field_something').