It depends on how you want to manifest the Wish
The basic use of this spell is to duplicate any other spell of 8th level or lower.
So if you use it in it's basic use, it doesn't matter what spell you're duplicating, if it magically puts a creature to sleep, it will fail. Interestingly you could argue that Wish didn't fail, but the spell it duplicated did, as the two can be considered to be separate.
However, with creative use, spells can use magical means to achieve non-magical effects: for example, Mage Hand could be used to pick up a ten-pound paperweight and drop it on someone's head, which would likely cause some non magical bludgeoning damage. This would be a way of indirectly attacking with this spell even though it can't be used to attack.
In a similar way, using Wish's alternate effect gives you great latitude and flexibility. You could give that flexibility to the DM, allowing them to decide what could happen by simply wishing "that the elf falls asleep." I wouldn't recommend it though; the spell's description itself tells you:
State your wish to the GM as precisely as possible. The GM has great latitude in ruling what occurs in such an instance; the greater the wish, the greater the likelihood that something goes wrong.
Be creative
Wishing for an elf to be restrained while an illusion of a college lecturer bores them to sleep might just be a small and creative enough wish for the GM to give it to you without too much of a likelihood of a mishap. David Coffron gives a good example in his answer of a more complicated possibility that could be a solution designed by a DM to have built in consequences, or could be a creative (though perhaps foolhardy) way to achieve your effect through magic though by non-magical means.