I'm using pymilvus 2.2.13.
I have a JSON field in my collection:
metadata: {"firld_a": "x", "list_field": ["A", "B", "C"]}
I want to get all the embeddings that have A in their list field,
I tried to use json_contains like the following example:
self.collection.query(
expr=f'json_contains(metadata["list_field"],"A")',
output_fields=['metadata']
)
and got a milvus error, how can I get the requested result?
You should use
json_contains_anyinstead ofjson_contains. Note thatjson_containsregards the value of each key as a whole, whilejson_contains_anychecks the elements.For details, refer to Advanced Operators here.