Prior to plug a new query parser we should refactor how the search query is parsed and transformed into an elasticsearch query.
Currently there are no strong separation between the parsing logic and the query building logic.
This should ease future development on integrating a new parser.
Note that MediaSearch (through the work done in T252692) is starting to use some of the components built here. There might be consolidation to be made between MediaSearch (WikibaseMediaInfo extension) and CirrusSearch while resuming work on this.