Py Program to query using metadata. Error

Hi guys, i am trying to make a very simple program to query my index through python.

this is the code

  query = {
        "query": {
            "bool": {
                "must": [
                    {"match": {"metadata.file_name": file_name}},
                    {"match": {"metadata.file_id": doc_id}},
                    {"match": {"metadata.user_id": user_id}},
                    {"match": {"metadata.page": page_num}}
                ]
            }
        }
    }

    response = await vector_store.search(
        query=query,
        search_type="similarity"
    )

where vector store is the initiated elastic client.

this query seems to work fine if i use it in the kibana console but in my program it is throwing an error

Error performing search: argument 'text': 'dict' object cannot be converted to 'PyString'

I have tried very long to find what is wrong but i am unable to fix it. I understand this might be more of a python issue than Elasticsearch issue but I confirmed the error is popping up from the packgage and since it is an elastic package i hope to find answers here.

please ask me if you need additional information please.

Welcome!

In case it helps, I wrote some code here: