In Judaism, the midrash (/ˈmɪdrɑːʃ/;Hebrew: מִדְרָשׁ; pl. מִדְרָשִׁים midrashim) is the genre of rabbinic literature which contains early interpretations and commentaries on the Written Torah and Oral Torah (spoken law and sermons), as well as non-legalistic rabbinic literature (aggadah) and occasionally the Jewish religious laws (halakha), which usually form a running commentary on specific passages in the Hebrew Scripture (Tanakh).
The Midrash, capitalized, refers to a specific compilation of these writings, primarily from the first ten centuries CE.
The purpose of midrash was to resolve problems in the interpretation of difficult passages of the text of the Hebrew Bible, using Rabbinic principles of hermeneutics and philology to align them with the religious and ethical values of religious teachers.
Gesenius ascribes the etymology of midrash to the qal of the common Hebrew verb darash (דָּרַשׁ) "to seek, study, inquire". The word "midrash" occurs twice in the Hebrew Bible: 2 Chronicles 13:22 "in the midrash of the prophet Iddo", and 24:27 "in the midrash of the Book of the Kings".