Add transform to document before index

Closes #6566
Will do.