  Considering the dimensionality of a typical reconfigurable intelligent
surface (RIS), channel state information acquisition in RIS-assisted systems
requires lengthy pilot transmissions. Moreover, the large aperture of the RIS
may cause transmitters/receivers to fall in its near-field region, where both
distance and angles affect the channel structure. This paper proposes a
parametric maximum likelihood estimation (MLE) framework for jointly estimating
the direct channel between the user and the base station (BS) and the
line-of-sight channel between the user and the RIS, in both far-field and
near-field scenarios. The MLE framework is first developed for the case of
single-antenna BS and later extended to the scenario where the BS is equipped
with multiple antennas. A novel adaptive RIS configuration strategy is proposed
to select the RIS configuration for the next pilot to actively refine the
estimate. We design a minimal-sized codebook of orthogonal RIS configurations
to choose from during pilot transmission with a dimension much smaller than the
number of RIS elements. To further reduce the required number of pilots, we
propose an initialization strategy with two wide beams. We demonstrate
numerically that the proposed MLE method needs only a few pilots for achieving
accurate channel estimates and further show that the presented framework
performs well under Rician fading. We also showcase efficient user channel
tracking in near-field and far-field scenarios.
