Preheat the oven to 180 Celsius (350 Fahrenheit) and wrap the beetroot in foil and place in a roasting try. Roast for 1 hour, or until tender. Set aside to cool before coarsely grating.
Combine the grated beetroot and apple in a saucepan along with the nutmeg, cloves and star anise. Add the red wine vinegar and caster sugar and place over a high heat. Bring to a simmer and then reduce to medium, cover and cook for 1 hour, or until thickened and reduced. Remove the lid and cook for a further 8 to 10 minutes until the liquid has evaporated. Set aside to cool completely.
Preheat the oven to 180 Celsius (350 Fahrenheit) and prepare the pastry. Cut the sheets of pastry in half and one sheet spread the beetroot marmalade over the middle of each half, leaving a 2cm border. Top with crumbled goats cheese and the thyme leaves.
Using a sharp knife, cut slits in each half of the pastry, starting about 4 cm in from the edge, spacing each cut 1cm apart. Carefully place each half on top of the base and press to seal around the filling. Trim the edges and then brush lightly with beaten egg.
Bake for 25 to 30 minutes, or until golden and puffed.
When sealing the pastry be careful not to press too hard on the cut edges as this will prevent the edges of the pastry rising. Also, when brushing the pastry with the beaten egg don't brush the edges as this will prevent the edges from puffing up.