Text extraction from large pool of documents of different formats
One option is to use Apache SOLR + Apache TIKA.
Apache TIKA has support for most common file formats, it extracts test content from files. Extracted text can be stored in SOLR.  SOLR supports various kinds of text + aggregation queries.
Tutorials :
https://blog.webnersolutions.com/apache-solr-indexing-all-files-in-a-folder-recursively
https://lucene.apache.org/solr/guide/6_6/introduction-to-solr-indexing.html
https://lucene.apache.org/solr/guide/6_6/uploading-data-with-solr-cell-using-apache-tika.html