Use image field in an entity query condition How to use image field in a condition of an entity query?

To get X nodes which have no image as value of field_image I've tried this:

$nids = \Drupal::entityQuery('node')
-&gt;condition('type','X')
-&gt;condition('field_image',NULL , '=')
-&gt;execute();


it doesn't work I got always empty result.
You could try:
$query->notExists('field_image');