How filter array objects

Description

I stored objects in Weaviate Embedded like the following:

example_object_1 = {
“name”: “John Smith”,
“home_address”: {
“street”: {
“number”: 123,
“name”: “Main Street”,
},
“city”: “London”,
},
“office_addresses”: [
{
“office_name”: “London HQ”,
“street”: {“number”: 456, “name”: “Oxford Street”},
},
{
“office_name”: “Manchester Branch”,
“street”: {“number”: 789, “name”: “Piccadilly Gardens”},
},
],
}

I would like to filter on street number, is this possible? Alternative approach?
I tried with

response = persons.query.near_text(
    query="person named John",
    limit=2,
    filters=(
        Filter.by_property("office_addresses").contains_any([ {"street":{"number":789}}])
 
    ),
    # distance= 0.8,       
    return_metadata=MetadataQuery(distance=True)
)

But does not work giving error:

value.json-or-python[json=list[union[str,uuid]],python=chain[is-instance[Sequence],function-wrap[sequence_validator()]]].0.uuid
  UUID input should be a string, bytes or UUID object [type=uuid_type, input_value={'street': {'number': 789}}, input_type=dict]

The collection was created as:

my_collection = client.collections.create(
    name="Person",
    vectorizer_config=Configure.Vectorizer.text2vec_cohere(model="embed-multilingual-light-v3.0"),
    properties=[
        Property(name="name", data_type=DataType.TEXT, ),
        Property(
            name="home_address",
            data_type=DataType.OBJECT,
            nested_properties=[
                Property(
                    name="street",
                   
                    data_type=DataType.OBJECT,
                    nested_properties=[
                        Property(name="number", data_type=DataType.INT),
                        Property(name="name", data_type=DataType.TEXT),
                    ],
                ),
                Property(name="city", data_type=DataType.TEXT,  index_searchable=True),
            ],
        ),
        Property(
            name="office_addresses",
            index_filterable=True,
            data_type=DataType.OBJECT_ARRAY,
            nested_properties=[
                Property(name="office_name", data_type=DataType.TEXT, index_searchable=True, index_filterable=True),
                Property(
                    name="street",
                    data_type=DataType.OBJECT,
                    nested_properties=[
                        Property(name="name", data_type=DataType.TEXT, index_searchable=True),
                        Property(name="number", data_type=DataType.INT),
                    ],
                ),
            ],
        ),
    ],
    
)

Server Setup Information

  • Weaviate Server Version: 2.7.4
  • Deployment Method: embedded
  • Multi Node? Number of Running Nodes: single node
  • Client Language and Version: Python
  • Multitenancy?: No

Any additional Information

Python weaviate-client version 4.9.3

hi @SergioEanX !!

The object data type has some limitations, as of now.

from our docs:

LIMITATIONS:
Currently, object and object[] datatype properties are not indexed and not vectorized.

Future plans include the ability to index nested properties, for example to allow for filtering on nested properties and vectorization options.

So in that case, you need to bring that information you want to filter out from the object data type, for example, a number or text.

Let me know if this helps!

THanks!