Manufacturers responses to this question vary but the general rule is to leave sufficient air space which is around 10-40mm from above. Leaving sufficient space from the sides is also important. Even when you install insulation coverable downlights you still need to leave a bit of space at the sides, so don't pack the insulation around the downlight canister.

Different types of light sources generate different amounts of heat. Halogen lights generate the most heat so would require more space. If a halogen lamp is left in contact with dry, flammable materials such as rock wool insulation it could ignite a fire. LED lights generate very little and pose less of fire hazard, but care should also be taken when positioning your downlights. Even if they're not a fire hazard, not following the manufacturers recommendations could cause the LED to overheat and reduce its lifespan.

Halogen Downlight From The Ceiling

This drawing below, which is taken from the JCC V50 downlight instructions shows that JCC recommend that you leave spaces of 75mm at each side. The thermal insulation can sit directly on top of the downlights airflow cap, but you should leave some space for airflow at the sides.

Drawing from the JCC V50 instructions
JCC V50