How to filter in metadata

I am storing some student vectors in Pinecone for a POC.
For each student i generate a Metadata dictionary :
{
“acc” : some_account_id ,
“date” : some_date,
“location” : {
“city” : some_city,
“country” : some_cnt
“lon” : random_float,
“lat” : random_float
}
}
So basically city is a subobject
How can i filter in metadata and say
find me students which are of account : “23” and either from city = x or boxed in square - I have something like this but it fails
{
“acc”:{
“$eq”:“test”
},
“$or”:[
{
“location”:{
“city”:{
“$eq”:“Berlin”
},
“country”:{
“$eq”:“Germany”
}
}
},
{
“location”:{
“lon”:{
“$gte”: lon_left_down,
“$lte”: lat_up_right
},
“lat”:{
“$gte”: lat_left_down,
“$lte”: lat_up_right
}
}
}
]
}
(those 4 up_right, left_down values i generate with a geopy function).
but i am getting bad results from that filter.

Hi @kristijobvite. The filter looks right. Can you share some of the unexpected results you’re getting?