Repository: deepset-ai/haystack

Issue:
`Document.to_dict(flatten=True)` overrides first-level fields by meta fields.
**Describe the bug**
When setting Document meta with same keys as first-level document attributes, the meta values win over the first-level attributes in `Document.to_dict(flatten=True)` serialization. 

**Error message**
Error that was thrown (if available)

**Expected behavior**
First-level attributes win over meta keys.

**Additional context**
Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.

**To Reproduce**
```python
doc = Document(content="from-content", meta={"content": "from-meta"})
doc.to_dict(flatten=True)
```
returns
```python
{'id': '...', 'content': 'from-meta', ...}
```

**FAQ Check**
- [ ] Have you had a look at [our new FAQ page](https://docs.haystack.deepset.ai/docs/faq)?

**System:**
 - OS:
 - GPU/CPU:
 - Haystack version (commit or version number):
 - DocumentStore:
 - Reader:
 - Retriever:

Discussion:

Solution patch:
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 4ac6c92fcd..dcebea854c 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -9,7 +9,7 @@ jobs:
     steps:
       - uses: actions/stale@v9
         with:
-          any-of-labels: 'proposal,community-triage'
+          any-of-labels: 'proposal,information-needed'
           stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
           days-before-stale: 30
           days-before-close: 10
diff --git a/haystack/dataclasses/document.py b/haystack/dataclasses/document.py
index 5f964aedcd..becd443dfc 100644
--- a/haystack/dataclasses/document.py
+++ b/haystack/dataclasses/document.py
@@ -132,7 +132,7 @@ def to_dict(self, flatten=True) -> Dict[str, Any]:
 
         if flatten:
             meta = data.pop("meta")
-            return {**data, **meta}
+            return {**meta, **data}
 
         return data
 
diff --git a/releasenotes/notes/document-to-dict-field-precedence-578a5e20a185852e.yaml b/releasenotes/notes/document-to-dict-field-precedence-578a5e20a185852e.yaml
new file mode 100644
index 0000000000..0f404499f0
--- /dev/null
+++ b/releasenotes/notes/document-to-dict-field-precedence-578a5e20a185852e.yaml
@@ -0,0 +1,4 @@
+---
+fixes:
+  - |
+    Make Document's first-level fields to take precedence over meta fields when flattening the dictionary representation.


Test patch:
diff --git a/test/dataclasses/test_document.py b/test/dataclasses/test_document.py
index 724513cc2b..9e705b6e41 100644
--- a/test/dataclasses/test_document.py
+++ b/test/dataclasses/test_document.py
@@ -185,6 +185,23 @@ def test_to_dict_with_custom_parameters_without_flattening():
     }
 
 
+def test_to_dict_field_precedence():
+    """
+    Test that Document's first-level fields take precedence over meta fields
+    when flattening the dictionary representation.
+    """
+
+    doc = Document(content="from-content", score=0.9, meta={"content": "from-meta", "score": 0.5, "source": "web"})
+
+    flat_dict = doc.to_dict(flatten=True)
+
+    # First-level fields should take precedence
+    assert flat_dict["content"] == "from-content"
+    assert flat_dict["score"] == 0.9
+    # Meta-only fields should be preserved
+    assert flat_dict["source"] == "web"
+
+
 def test_from_dict():
     assert Document.from_dict({}) == Document()