How to use nested Timestamp ?

Hi,

I have an export file from MongoDB, timestamp column is something like this:

“timestamp”:{"$date":“2016-…”}

I tried this in my spec file but this is not working, removing flattenSpec doesn’t work also. In both of them, indexing gives error related to timestamp.

“parser” : {

“type” : “string”,

“parseSpec” : {

“format” : “json”,

“flattenSpec”: {

 "useFieldDiscovery": true,

“fields”: [

{

“type”: “nested”,

“name”: “timestamp”,

“expr”: “$.timestamp.$date”

}]},

“dimensionsSpec” : {

“dimensions” : [

]

},

“timestampSpec” : {

“format” : “auto”,

“column” : “timestamp”

}

}

},

How can i handle this ? I don’t want to write a script that moves timestamp to root level. (If I don’t have to)

Kind regards,

What error are you getting and what version of Druid are you using?

I am using Druid 0.9.0, I wrote the script and can’t reproduce the error now, but it was something like “Unparsable timestamp etc.”

If you got “Unparseable timestamp” rather than “Null timestamp” then probably the flattenSpec actually did do the flattening, but Druid couldn’t parse your timestamp. You might need to customize the time format instead of using “auto”.

I don’t remember the error well, it is fixed for me by a script written in 5 min. Thanks anyway!

Hi prinull, @prinull
can you please share how you fixed this?

thank

VR

It was a long time ago. But as far as I understand from my previous answer, I wrote a script to eliminate nesting that is my timestamp was not nested anymore.