The rabbis distinguished two registers of midrash by what the interpreter was seeking. Midrash halakhah works through the legal sections of the Torah and derives binding law from the precise wording of the verses, using formal hermeneutical rules such as the inference from minor to major and the analogy between identical phrases. The classical collections of this kind are tannaitic: the Mekhilta of Rabbi Ishmael on Exodus, the Sifra on Leviticus, and the Sifre on Numbers and Deuteronomy, each associated by scholars with one of the two early interpretive schools, those of Rabbi Ishmael and Rabbi Akiva.
Midrash aggadah, by contrast, seeks meaning rather than statute. It fills the silences of the biblical narrative, gives speeches to Abraham and arguments to Moses, reconciles contradictory verses through story, and turns Scripture toward consolation and moral exhortation. Its masterpieces include Genesis Rabbah, with its dense verse-by-verse weave, Leviticus Rabbah and Pesikta de-Rav Kahana, built as cycles of homilies for sabbaths and festivals, and the later Tanhuma family. The two registers were never sealed off from each other; legal collections carry stories and homiletic ones carry law, because for the rabbis the whole Torah, narrative and statute alike, was a single fabric to be searched.