Elves cannot be magically put to sleep, according to their Fey Ancestry trait.
The catnap spell (Xanathar's Guide to Everything, p. 151) can make up to three willing creatures fall unconscious (and get the benefit of a short rest after the 10-minute duration).
Can elves be affected by the catnap spell?
Best Answer
RAW - Yes, catnap can affect elves
Catnap is a bit deceptively named because, despite the name and the fact that one of its effects mimics a short rest, Catnap does not actually technically put creatures to sleep. And this is not the only example of a spell/ability confusingly named.1
The important thing to realize about this is that the names of spells/abilities have no mechanical meaning. Only the spell effect description describes how the spell works.
Nowhere in the spell does it say anything about putting creatures to sleep, it only imposes the unconscious condition on them.2
And, since elves are not immune to the unconscious condition, they are affected by the spell like anybody else is.
Rules as Intended
Jeremy Crawford has confirmed this interpretation is as intended:
1 - A few examples: Sacred flame does not do fire damage. Chill touch does not do cold damage and is also not a touch spell. Daylight does not actually create sunlight. Detect good and evil does not actually detect alignment.
2 - Compare this to sleep which says: