I have switched from working nights to swings and my watch won't record when I'm sleeping.
In Connect web, choose device settings and then user settings. I didn't check but I presume it's similar in the app although web connect might override what you do in the app.