code: def test_lookup_with_filter_by_metadata(ses):
      ses.add_image(
          "test1.jpg",
          metadata=_metadata("foo", "project-x"),
          refresh_after=True,
      )
      ses.add_image(
          "test2.jpg",
          metadata=_metadata("foo", "project-x"),
          refresh_after=True,
      )
      ses.add_image(
          "test3.jpg",
          img="test1.jpg",
          metadata=_metadata("foo", "project-y"),
          refresh_after=True,
      )
  
      ses.add_image(
          "test2.jpg",
          metadata=_metadata("bar", "project-x"),
          refresh_after=True,
      )
  
      r = ses.search_image(
          "test1.jpg", pre_filter=_nested_filter("foo", "project-x")
      )
      assert len(r) == 2
  
      r = ses.search_image(
          "test1.jpg", pre_filter=_nested_filter("foo", "project-z")
      )
      assert len(r) == 0
  
      r = ses.search_image(
          "test1.jpg", pre_filter=_nested_filter("bar", "project-x")
      )
      assert len(r) == 1
  
      r = ses.search_image(
          "test1.jpg", pre_filter=_nested_filter("bar-2", "project-x")
      )
      assert len(r) == 0
  
      r = ses.search_image(
          "test1.jpg", pre_filter=_nested_filter("bar", "project-z")
      )
      assert len(r) == 0
  
file_path: image-match/tests/test_elasticsearch_driver_metadata_as_nested.py
imports: import pytest
  import os
  import hashlib
  from elasticsearch import Elasticsearch, ConnectionError, RequestError, NotFoundError
  from time import sleep
  from image_match.elasticsearch_driver import SignatureES
  from PIL import Image
label_desc: Use image node_id 7 for calling a global function with example usage: test_lookup_with_filter_by_metadata(ses) without return types