There is a substantial effort in the physics community to search for dark matter interactions with the Standard Model of particle physics. In particular, direct detection experiments search for rare collisions between dark matter particles and nucleons. Such collisions would also occur in the early Universe, enabling a search for dark matter interactions using cosmological observations in a parameter space that is highly complementary to that of direct detection. In this talk, I will describe the formalism of nonrelativistic effective field theory developed for direct detection in the context of cosmology. For dark matter masses extending down to 15 keV, I will show the upper limits on the scattering cross section, obtained using the Planck 2015 cosmic microwave background (CMB) temperature, polarization, and lensing anisotropy. The effect of scattering is most prominent on small scales in the CMB power spectra and in the matter power spectrum, and I will conclude with a discussion on improving constraints with data from ground-based CMB experiments and galaxy surveys.