Facing issue in retrieval - GDS - Python

Hello All,

I am dumping all my images as embeddings to neo4j and doing a cosine similarity on top of it.
Here is my code:

def find_and_plot_similar_images(image_path, tok_k=5):

    query_embeddings = get_image_embeddings(image_path)
    query_embeddings = list(query_embeddings)

    query = (
        """
            MATCH (a:CarImage)
            WITH a, gds.similarity.cosine(a.embeddings, $query_embeddings) AS similarity
            ORDER BY similarity DESC
            LIMIT $top_k
            RETURN a.id AS image_id, a.embeddings AS embeddings, a.path as image_path, similarity
        """
    )

    image_paths = []
    with GraphDatabase.driver(uri) as driver:
        with driver.session() as session:
            result = session.run(query, query_embeddings=query_embeddings, top_k=3)
            image_ids = []
            similarities = []
            print(result)

find_and_plot_similar_images("39.jpg")

Getting below error:

Received notification from DBMS server: {severity: WARNING} {code: Neo.ClientNotification.Statement.UnknownPropertyKeyWarning} {category: UNRECOGNIZED} {title: The provided property key is not in the database} {description: One of the property names in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing property name is: id)} {position: line: 6, column: 22, offset: 204} for query: '\n            MATCH (a:CarImage)\n            WITH a, gds.similarity.cosine(a.embeddings, $query_embeddings) AS similarity\n            ORDER BY similarity DESC\n            LIMIT $top_k\n            RETURN a.id AS image_id, a.embeddings AS embeddings, a.path as image_path, similarity\n        '

Can anyone please help?
What am I doing wrong?
I am using community version of neo4j==5.25.1 and GDS==2.12

Hey @jay7ta ,
The issue should be the last line in the query
RETURN a.id AS image_id, a.embeddings AS embeddings, a.path as image_path, similarity

a.id is not possible, as you did not define an id property. You can use elementId() (docs) if you want to retrieve the built-in id.
Or you set your own id on each node in your setup.

Thank you so much @florentin_dorre for the quick reply.
Its working fine.