Idris al-Awdi (may Allah have mercy on him) said: Sa'id bin Abi Burdah (may Allah have mercy on him) brought out a letter and said that this letter was from Sayyiduna Umar (may Allah be pleased with him) to Sayyiduna Abu Musa (may Allah be pleased with him). He mentioned the hadith, in which it says: Understand! Understand well! When a matter raises doubts in your heart and it is not found in the Qur'an and Sunnah, then try to recognise similar matters, then make analogy between the matters, and aim for what is most beloved to Allah Almighty and most closely resembles what is in your view.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20347