Our use case is like this: client will send json containing a field:
{
"start_time": "2025-03-12T01:33:45.377Z",
...
}
We need to convert or parse this start_time
field to epoch millis like this:
"start_time": 1741743225377,
It was easy with just 1 http request using curl:
curl -XPUT "$url/_ingest/pipeline/date-string-to-millis" -ku admin:$pw -H 'Content-Type: application/json' -d'
{
"description": "Convert date string to epoch millis",
"processors": [
{
"date": {
"field": "start_time",
"formats": ["date_time"],
"output_format": "epoch_millis",
"target_field": "start_time"
}
},
{
"convert": {
"field": "start_time",
"type": "long"
}
}
]
}'
However when we try to create this ingest pipeline on opensearch-java
client, there is no output_format
property. I also check elasticsearch-java
client and there no output_format
as well, is this intended? How can I create this pipeline on opensearch-java client? If not possible, is there any other way we can parse that date string to epoch_millis
?