Write a function to detect patterns or anomalies within a stream of incoming request metadata.
Given a list of request metadata dictionaries, a window size, and a minimum occurrence count, return the indices of every request whose metadata fingerprint belongs to a repeated pattern within a rolling window. A fingerprint consists of all key-value pairs, compared independently of dictionary key order. Each qualifying index should appear once, in ascending order.
Use the signature and input/output shapes below. Metadata values are strings.
def detect_metadata_patterns(metadata_stream, window_size, min_occurrences):