Given an essentially unitary contraction and an arbitrary unitary dilation of it, there is a naturally associated spectral flow that is shown to be equal to the index of the operator. This result is interpreted in terms of the K-theory of an associated mapping cone. It is then extended to connect Z2 indices of odd symmetric Fredholm operators to a Z2-valued spectral flow.