Elasticsearch For Beginners: Indexing your Gmail Inbox
Worth noting that if you like the idea of indexing your mail, there's also Notmuch. It's a dedicated email search and indexing tool and is very nice when paired with something like OfflineIMAP to sync messages.https://notmuchmail.org