By monitoring the resonant properties of nanostructured-materials it is possible to achieve an ultra-sensitive detection of the modification of their near-field properties: this property can be used in sensors. The structuring of materials can be done at the scale of the wavelength like in opals or at a sub-wavelength scale like in nano-pillars or in plasmonic resonators.