We study the Atiyah-Patodi-Singer (APS) index, and its equality to the spectral flow,
in an abstract, functional analytic setting. More precisely, we consider a (suitably continuous or
differentiable) family of self-adjoint Fredholm operators A(t) on a Hilbert space, parametrised
by t in a finite interval. We then consider two different operators, namely D := d/dt + A (the
abstract analogue of a Riemannian Dirac operator) and D := d/dt − iA (the abstract analogue of
a Lorentzian Dirac operator). The latter case is inspired by a recent index theorem by Bär and
Strohmaier (Amer. J. Math. 141 (2019), 1421–1455) for a Lorentzian Dirac operator equipped
with APS boundary conditions. In both cases, we prove that the Fredholm index of the operator
D equipped with APS boundary conditions is equal to the spectral flow of the family A(t) .