Sony’s new smartphone Xperia Z2 is still awaiting roll-out in the Western markets. However, popular XDA developer DooMLoRD has already rooted the device and released instructions and links for installing recovery.
The ClockworkMod (CWM)-based recovery version 22.214.171.124 works for Xperia Z2 and is quite easy to install, but you have to unlock the bootloader first. Then simply flash the recovery image and install the Chainfire SuperSU package to get the root access. Your Xperia Z2 should have Android 4.4.2 KitKat build no. 17.1.A.2.36 or ROM with same firmware. You can find the detailed instructions and links at the XDA forum.
The battery should be fully charged before beginning the rooting process. Be sure to take a back-up of everything in case anything goes wrong. Also note that the device warranty will become void after the root method is installed.