Reconfigurable antennas (RAs) are capable of dynamically and swiftly changing their radiation patterns, which enables them to adapt to channel variations and enhance link capacity. To fully exploit the benefits of RAs, the antenna states need to be optimally selected on-the-fly. The main challenges are two-fold: uncertainty of channel over time, and a large number of candidate antenna states. Previous approaches can only deal with a small number of antenna states, or suffer from slow convergence. In this paper, we propose an optimal online antenna state selection framework for SISO and MISO wireless links, based on the Thompson sampling algorithm for general stochastic bandits. In order to enhance the convergence rate for large antenna state sets, we propose two novel antenna state pruning strategies and integrate them with Thompson sampling, which exploit the relationship between antenna radiation pattern and channel state. The first one requires knowledge of angles of departure of the channel, while guaranteeing convergence to optimality. The other one doesn't require any prior channel information. Simulation results using a real-world reconfigurable antenna's radiation patterns show that, both of our proposed learning algorithms can significantly improve the convergence rate and yield much lower regret compared with existing schemes.