Using a conditional OR in a view query alter programmatically
You can do this by using orConditionGroup():

$query = \Drupal::entityQuery('map');
  $group = $query-&gt;orConditionGroup()
    -&gt;condition('attributes.color', 'red')
    -&gt;condition('attributes.color', 'green');
  $entity_ids = $query
    -&gt;condition('attributes.building_type', 'bikeshed')
    -&gt;condition($group)
    -&gt;execute();


Example from https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Query!QueryInterface.php/function/QueryInterface%3A%3AorConditionGroup/8.2.x