Hello all,
I am trying to "enrich" my json.
My problem happens when I try to give it a timestamp.
My requirement is to give it time in this format:
${now():format("yyyy-MM-dd HH:mm",'Z')}
So at the top level and every element of my json should have an entry
called
EX:
"createTime":"2018-08-07 14:12"
To do this I am creating an attribute "createTime" and setting it to
"${now():format("yyyy-MM-dd HH:mm",'Z')}"
I then pass that to JoltTransform but it fails with:
"Unable to unmarshal JSON to object"
If I set my createTime attribute to hard code EX: "2018008-07 09:15"
Then it works.
I've also tried setting my createTime toString but that does not help.
What helps is if I set my createTime to ${createTime:escapeJson()}
But then elasticSearch does not like it since it has a "\n" in the end and
the elasticSearch index uses schema validation.
At this stage, we have not sprint planned to use records so when I ingest
to ES I am using PutElasticsearchHttp
TLDR:
JoltTransform errors out when I pass it an attribute set by calling the
now() function.
My Jolt spec looks like this:
Jolt Transformation DSL
Chain
[{
"operation": "default",
"spec": {
"isVerified":"TRUE",
"recentResultDate" : "",
"createDate" : "${createDate}",
"*":{
"resultCode":"GREEN",
"resultDate":"${createDate}"
}
}
}]
--
Juan Carlos Sequeiros