Allow using sort parameter from the query for template replace as well as bulk update & replace operations. We now also mapped fields used in sort to the domain type considering field annotations. Also updated javadoc and reference documentation. Original Pull Request: #4888