Add transform to document before index

Closes #6566