ESSENTIALS-398: Improved filtering for document (and compound) types.