We present an ab initio study of core excitations of solid-state materials focusing on the role of electron-hole correlation. In the framework of an all-electron implementation of many-body perturbation theory into the exciting code, we investigate three different absorption edges of three materials, spanning a broad energy window, with transition energies between a few hundred to thousands of eV. Specifically, we consider excitations from the Ti K edge in rutile and anatase TiO2, from the Pb M4 edge in PbI2, and from the Ca L2,3 edge in CaO. We show that the electronhole attraction rules x-ray absorption for deep core states, when local fields play a minor role. On the other hand, the local-field effects introduced by the exchange interaction between the excited electron and the hole dominate excitation processes from shallower core levels, separated by a spin-orbit splitting of a few eV. Our approach yields absorption spectra in good agreement with available experimental data, and allows for an in-depth analysis of the results, revealing the electronic contributions to the excitations, as well as their spatial distribution.