Domain name analyzer/tokenizer with Elasticsearch

Elasticsearch is amazingly easy to use given how powerful it is, but sometimes the functionality seems to be a couple of years ahead of the documentation. Case in point: I wanted to analyze hostnames/domains to mimic the “site:” feature of Google search. The way that works is the match from right to left, only on whole parts (‘labels’ as I’ve discovered they’re called in the DNS system).