“To look for a needle in a bottle of hay”, after the french botte for ‘bundle’.
On the odd use of bottle: [Puck, to Titania] I could munch your good dry oats, methinks I have a great desire to a bottle of hay: good hay, sweet hay, hath no fellow.
Interestingly, haywire is derived from a frenzied behaviour likened to the chaotic uncoiling of a feel of hay baling wire.