  We consider second order elliptic differential operators on a bounded
Lipschitz domain $\Omega$. Firstly, we establish a natural one-to-one
correspondence between their self-adjoint extensions, with domains of
definition containing in $H^1(\Omega)$, and Lagrangian planes in
$H^{1/2}(\partial\Omega)\times H^{-1/2}(\partial\Omega)$. Secondly, we derive a
formula relating the spectral flow of the one-parameter families of such
operators to the Maslov index, the topological invariant counting the signed
number of conjugate points of paths of Lagrangian planes in
$H^{1/2}(\partial\Omega)\times H^{-1/2}(\partial\Omega)$. Furthermore, we
compute the Morse index, the number of negative eigenvalues, in terms of the
Maslov index for several classes of the second order operators: the
$\vec{\theta}-$periodic Schr\"odinger operators on a period cell $Q\subset
\mathbb{R}^n$, the elliptic operators with Robin-type boundary conditions, and
the abstract self-adjoint extensions of the Schr\"odinger operators on
star-shaped domains. Our work is built on the techniques recently developed by
B.Boo{\ss}-Bavnbek, K. Furutani, and C. Zhu, and extends the scope of validity
of their spectral flow formula by incorporating the self-adjoint extensions of
the second order operators with domains in the first order Sobolev space
$H^1(\Omega)$. In addition, we generalize the results concerning relations
between the Maslov and Morse indices quite recently obtained by G. Cox, J.
Deng, C. Jones, J. Marzuola, A. Sukhtayev and the authors. Finally, we describe
and study a link between the theory of abstract boundary triples and the
Lagrangian description of self-adjoint extensions of abstract symmetric
operators.
