[Advanced usage] Can two docs be combined into single doc?

There’re two docs that have the same “transaction_id”: “tx1”. The difference is the timestamp and “device” fields.
Can they be combined into s single doc and device becomes an array includes device vaule from multiple docs?

The goal is to reduce the number of docs of an index in the cluster. These are logs from multiple hosts but for the same target hence I’m looking for options to optimize it.

{
  "_index": "filebeat-1",
  "_type": "_doc",
  "_id": "_0yb24ABPZFbAXcuKnK0",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2022-05-19T09:16:59.885Z",
    "device": "d14181",
    "container_keyword": "bucket999",
    "severity": "info",
    "transaction_id": "tx1",
    "request_method": "GET",
    "programname": "apache",
    "object_keyword": "test-object",
    "status_int": "200",
    "partition": "245980",
    "content_length_l": "547762"
  },
  "fields": {
    "@timestamp": [
      "2022-05-19T09:16:59.885Z"
    ]
  },
  "sort": [
    1652951819885
  ]
}


{
  "_index": "filebeat-1",
  "_type": "_doc",
  "_id": "_0yb24ABPZFbAXcuKnKC",
  "_version": 1,
  "_score": null,
  "_source": {
    "@timestamp": "2022-05-19T09:16:59.900Z",
    "device": "d333",
    "container_keyword": "bucket999",
    "severity": "info",
    "transaction_id": "tx1",
    "request_method": "GET",
    "programname": "apache",
    "object_keyword": "test-object",
    "status_int": "200",
    "partition": "245980",
    "content_length_l": "547762"
  },
  "fields": {
    "@timestamp": [
      "2022-05-19T09:16:59.900Z"
    ]
  },
  "sort": [
    1652951819886
  ]
}