Weekyear_week as scripted field

I don't enough about Painless to actually help you out here, but looking at the API reference, it seems like you might be able to specify a custom format using the DateTImeFormatter.