Combine the yeast, sugar, melted butter, egg, and milk in the bowl of an electric mixer fitted with a dough hook. Beat on low speed for 1 minute.
Add the salt, rye flour, all-purpose flour, and caraway seeds. Beat at low speed until all of the flour is incorporated, about 1 minute. Then, beat at medium speed until the mixture forms a ball, leaves the sides of the bowl and climbs up the dough hook.
Remove the dough from the bowl. Using your hands, form the dough into a smooth ball. Lightly oil a bowl.
Place the dough in the bowl and turn it to oil all sides. Cover with plastic wrap and set aside in a warm, draft-free place until it doubles in size, about 1 hour.
Preheat the oven to 350 degrees F and lightly grease a 5 1/2 by 9-inch baking pan.
Remove the dough from the bowl and invert onto a lightly floured surface. Gently knead the dough several times. Tuck and roll so that any seams disappear into the dough and place in the prepared baking pan. Cover with plastic wrap and set aside in a warm, draft-free place until it doubles in size, about 1 hour.
Use a pastry brush to brush the egg lightly over the top of the dough. Bake until lightly brown, about 45 minutes. Remove from the oven and cool on a rack.