Date Filters over Weaviate data

I’m pulling data from mongo to weaviate for semantic vector search. The date format is in ISO, but is saved in Weaviate as a string (mistakenly) : “{‘$date’: ‘2023-08-08T19:00:00.000Z’}”. Is there any way I can query like this:

where_filter = {
“path”: [“date”],
“operator”: “GreaterThan”,
“valueText”: Here is where I can convert my date string to whatever is compatible
}

in python:

self.weaviate_client
.query.get(schema, [*fields_to_search, “_additional {certainty}”])
.with_near_vector(vec)
.with_where(where_filter)
.with_limit(5000)
.do()

Or do I need to run an update to convert the date type to RFC in Weaviate before I can begin filtering on the field?

Hi @Mick_Cunningham ! Welcome to our community :hugs:

You will have to convert them. Weaviate will understand your data as string, and will not be able to compare it with a date.

Also, you will need to change the datatype to a date one:

Let me know if this helps.

Thanks!

1 Like