I have a default namespace “” and a second namespace “templates”. I only want to search in the default namespace “” and NOT the second namespace “templates”… However queries over namespace=“” always return items from namespace=“templates”. Therefore, I am trying to use metadata filtering. Every item in the “templates” namespace also has an metadata tag “is_template”:“True”. However, the filter
{“is_template”: {“$nin”: [“True”, “False”]}} over the namespace “” STILL yields me only results with “is_template”=“True”.
I want to query over the namespace “” and yield only items that don’t even have the attribute “is_template”. Items in the namespace “” do not have any “is_template” attribute.
Is this possible?
This is odd behavior. Can you share the full query you’re using so we can see the full context? Be sure not to include the API key or anything like that, just the queries themselves.
filter={“is_template”: {“$nin”: [“True”, “False”]}}
embedding = get_embedding(query, embedding_model)
response = index.query(vector=embedding, top_k=10, include_metadata=True, namespace=“”, filter=filter)
response: [{‘id’: ‘8’,
‘metadata’: {‘is_template’: True},
‘score’: 0.863455474,
‘values’: }, {‘id’: ‘4’,
‘metadata’: {‘is_template’: True},
‘score’: 0.857818961,
‘values’: }, {‘id’: ‘68’,
‘metadata’: {‘is_template’: True},
‘score’: 0.852902949,
‘values’: }, {‘id’: ‘83’, ‘metadata’: {‘is_template’: True}, ‘score’: 0.852275, ‘values’: }, {‘id’: ‘22’,
‘metadata’: {‘is_template’: True},
‘score’: 0.852252901,
‘values’: },…etc…]
This shoudl be impossible in my opinion because anything with the tag ‘is_template’ cannot have the namespace “”. it has the namespace “templates”.