We use 7 years of electron and positron Fermi-LAT data to search for a possible excess in the direction of the Sun in the energy range from 42 GeV to 2 TeV. In the absence of a positive signal we derive flux upper limits which we use to constrain two different dark matter (DM) models producing $e^+ e^-$ fluxes from the Sun. In the first case we consider DM model being captured by the Sun due to elastic scattering and annihilation into $e^+ e^-$ pairs via a long-lived light mediator that can escape the Sun. In the second case we consider instead a model where DM density is enhanced around the Sun through inelastic scattering and the DM annihilates directly into $e^+ e^-$ pairs. In both cases we perform an optimal analysis, searching specifically for the energy spectrum expected in each case, i.e., a box-like shaped and line-like shaped spectrum respectively. No significant signal is found and we can place limits on the spin-independent cross-section in the range from $10^{-46}~cm^2$ to $10^{-44}~cm^2$ and on the spin-dependent cross-section in the range from $10^{-43}~cm^2$ to $10^{-41}~cm^2$. In the case of inelastic scattering the limits on the cross-section are in the range from $10^{-43}~cm^2$ to $10^{-41}~cm^2$. The limits depend on the life time of the mediator (elastic case) and on the mass splitting value (inelastic case), as well as on the assumptions made for the size of the deflections of electrons and positrons in the interplanetary magnetic field.