Laser induced breakdown spectroscopy(LIBS)was an analysis technique based on laser plasma atomic emission spectroscopy. Because of its fast, non-destructive and high sensitivity, it was widely used in various fields. In order to study the laser induced breakdown spectra of heavy metal element and non-metal element in the soil, A method based on traditional laser induced breakdown spectroscopy (LIBS) technology with cavity constraints was proposed to improve the plasma emission spectrum. In this paper, the cylindrical aluminum cavity with the diameter of 2mm, 3mm, 4mm, 5mm, and 6mm at the same thickness were placed on the surface of the soil sample, the laser energy was set to 30mJ, and the pulse repetition frequency was set to 5Hz. The plasma lines of heavy metal element (Ba II 455.4nm) and non-metal element (Si I 288.158nm) under different cavity constraints were obtained, and the enhancement factor and signal-to-noise ration(SNR)of these two characteristic lines under different diameter cavity constraints were studied. The experimental results show that the plasma line has a certain enhancement under the condition of cavity restriction than without cavity restriction. As the diameter of the circular cavity increases, the enhancement factor tends to increase first and then decrease, and the spectral enhancement effect is the best when the diameter is 5mm. The change trend of the signal-to-noise ratio is consistent with the enhancement factor, which reaches the maximum when the cavity diameter is 5 mm. The study of this technology can provide guidance for the qualitative analysis of Ba and Si elements in soil.