Repository: deepset-ai/haystack

Issue:
Weaviate update_document_meta shouldn't require date field to be present
**Describe the bug**
When using the `update_document_meta` method in `WeaviateDocumentStore`, the docstring describes that only specified fields will be overwritten and unspecificed fields will be skipped. 

I have supplied a custom schema to `WeaviateDocumentStore` that defines a date field. However, when I want to update a non-date field only, the method identifies a `date_field` from the schema and tries to get it from the `meta` method argument.

In the error message below, this `date_field` is 'creation_date'.

This should be a simple fix of checking if `date_field` is present in `meta`. *I'm happy to submit a PR with a fix given the go ahead.*

**Error message**
```
Traceback (most recent call last):
  File "/mnt/c/Users/jsmith/Project/transfer_index.py", line 202, in update_meta
    weaviate_document_store.update_document_meta(vector_id, {"source_name": "foo"})
  File "/home/jsmith/.cache/pypoetry/virtualenvs/project-tbIY5cJn-py3.10/lib/python3.10/site-packages/haystack/document_stores/weaviate.py", line 615, in update_document_meta
    if isinstance(meta[date_field], str):
KeyError: 'creation_date'
```

**Expected behavior**
The method should check if any field names in `date_fields` are present in `meta` and then convert the date to RFC3339 format if present. If not present, this part should be skipped.

**To Reproduce**
```
from haystack.document_stores import WeaviateDocumentStore
from haystack.schema import Document

schema = {
    "classes": [
        {
            "class": "test",
            "description": "Haystack index, it's a class in Weaviate",
            "invertedIndexConfig": {"cleanupIntervalSeconds": 60},
            "vectorizer": "none",
            "properties": [
                {
                    "dataType": ["text"],
                    "description": "Document Content (e.g. the text)",
                    "name": "content",
                },
                {
                    "dataType": ["string"],
                    "description": "dynamic property content_type",
                    "name": "content_type",
                    "tokenization": "word",
                },
                {
                    "dataType": ["date"],
                    "description": "dynamic property creation_date",
                    "name": "creation_date",
                },
                {
                    "dataType": ["string"],
                    "description": "dynamic property source_name",
                    "name": "source_name",
                    "tokenization": "word",
                },
            ],
            "vectorIndexConfig": {"distance": "cosine"},
            "replicationConfig": {"factor": 1},
        }
    ]
}

documents = [
    Document(
        id="3cbce813-c9ec-419b-a441-22dee8f34304",
        content="test_content_1",
        meta={"creation_date": "2021-01-01", "source_name": "test_source_1"},
    ),
    Document(
        id="1c44c712-7602-4286-95e9-54adfad6bb03",
        content="test_content_2",
        meta={"creation_date": "2021-01-02", "source_name": "test_source_2"},
    ),
]

doc_store = WeaviateDocumentStore(schema=schema, index="test")
doc_store.write_documents(documents)
doc_store.update_document_meta(
    "3cbce813-c9ec-419b-a441-22dee8f34304", {"source_name": "test_source_1_updated"}
)
```

**FAQ Check**
- [ x] Have you had a look at [our new FAQ page](https://docs.haystack.deepset.ai/docs/faq)?

**System:**
 - OS: Ubuntu 20 in WSL2
 - GPU/CPU: CPU
 - Haystack version (commit or version number): 1.14.0
 - DocumentStore: WeaviateDocumentStore
 - Reader: N/A
 - Retriever: N/A



Discussion:
@joekitsmith we would very happy to accept a PR to fix this!

Resolving patch:
diff --git a/haystack/document_stores/weaviate.py b/haystack/document_stores/weaviate.py
--- a/haystack/document_stores/weaviate.py
+++ b/haystack/document_stores/weaviate.py
@@ -612,8 +612,9 @@ def update_document_meta(
         # Weaviate requires dates to be in RFC3339 format
         date_fields = self._get_date_properties(index)
         for date_field in date_fields:
-            if isinstance(meta[date_field], str):
-                meta[date_field] = convert_date_to_rfc3339(str(meta[date_field]))
+            if date_field in meta:
+                if isinstance(meta[date_field], str):
+                    meta[date_field] = convert_date_to_rfc3339(str(meta[date_field]))
 
         self.weaviate_client.data_object.update(meta, class_name=index, uuid=id)
 


Test patch: