0

I Want to convert field to date format like that:

{ 
    convertTimestamp {
        field : document_date
        inputFormats : ["yyyy-MM-dd"]
        inputTimezone : UTC
        outputFormat : "yyyy"
        outputTimezone : UTC
}

The input format is yyyy-MM-dd and I want to output only year's part yyyy.

But When I run it - I've got an Exception: org.apache.solr.common.SolrException: Invalid Date String:'1992-06-04'.

I've read here that morphline requires obligatory format yyyy-MM-dd'T'HH:mm:ss'Z' but you can find on morphline's Github that TimestampBuilder has default format date like:

DEFAULT_DATE_FORMATS.add("yyyy-MM-dd"); 

Exception remains even if i change output format to yyyy-MM-dd. It disappears only when I add constant sufix like: T23:59:59Z

Community
  • 1
  • 1
Ziemo
  • 941
  • 8
  • 27

1 Answers1

1

It's not about what Morphline's default format is . I have worked for quite a sometime with Solr , and the only format it supports is yyyy-MM-dd'T'HH:mm:ss'Z'. Look below for a very descriptive documentation about it from Solr's documentation webpage only .enter image description here

Also , the link of the Morphline's Github Code states in its last comments this thing A suite of default date formats that can be parsed,and thus transformed to the Solr specific format . Find below image for reference enter image description here

So basically, it also adheres to the Standard Solr Format , and ultimately such formats just make good candidates to be transformed into Solr's format. Hope this helps :) .

Saurabh Chaturvedi
  • 2,028
  • 2
  • 18
  • 39