{
"id": "poc.transform",
"version": "7.17.11",
"create_time": 1709818588566,
"source": {
"index": [
"poc.test.source*"
],
"query": {
"match_all": {}
}
},
"dest": {
"index": "poc.test.transform"
},
"frequency": "1m",
"sync": {
"time": {
"field": "@timestamp",
"delay": "60s"
}
},
"latest": {
"unique_key": [
"entity_name.keyword"
],
"sort": "occured_timestamp"
},
"settings": {
"max_page_search_size": 500
}
}
Here I am trying to get the latest records from the source index and ingest the data into transformed index. Since I cannot depend on the ingestion time(@timestamp) to find the latest record, because of the possibility of non chronological insertion of data. I have a field called occured_timestamp. From which I have to get the latest record. Hence I have added it to sort key. But this seems to be not working. No matter what is the value in occured_timestamp. Data seems to be getting ingested into transformed index. Anything wrong with my code?
Example Source Index
[
{
"entity_name":"enity1",
"occured_timestamp":"2024-03-07T09:14:29.000Z"
"@timestamp": "2024-03-07T14:02:59.000Z"
},
{
"entity_name":"enity1",
"occured_timestamp":"2024-03-07T08:01:29.000Z"
"@timestamp": "2024-03-07T14:03:59.000Z"
},
{
"entity_name":"enity1",
"occured_timestamp":"2024-03-07T07:01:29.000Z"
"@timestamp": "2024-03-07T14:04:59.000Z"
}
]
Output Expected in destination Index
[
{
"entity_name":"enity1",
"occured_timestamp":"2024-03-07T09:14:29.000Z"
"@timestamp": "2024-03-07T14:02:59.000Z"
}]