  In this paper we compute the superconformal index of 2d (2,2) supersymmetric
gauge theories. The 2d superconformal index, a.k.a. flavored elliptic genus, is
computed by a unitary matrix integral much like the matrix integral that
computes 4d superconformal index. We compute the 2d index explicitly for a
number of examples. In the case of abelian gauge theories we see that the index
is invariant under flop transition and CY-LG correspondence. The index also
provides a powerful check of the Seiberg-type duality for non-abelian gauge
theories discovered by Hori and Tong.
  In the later half of the paper, we study half-BPS surface operators in N=2
superconformal gauge theories. They are engineered by coupling the 2d (2,2)
supersymmetric gauge theory living on the support of the surface operator to
the 4d N=2 theory, so that different realizations of the same surface operator
with a given Levi type are related by a 2d analogue of the Seiberg duality. The
index of this coupled system is computed by using the tools developed in the
first half of the paper. The superconformal index in the presence of surface
defect is expected to be invariant under generalized S-duality. We demonstrate
that it is indeed the case. In doing so the Seiberg-type duality of the 2d
theory plays an important role.
