- There's way too much code in ElasticsearchHSQueryImpl, we should split it into smaller class to make it easier to understand/maintain
- I'm pretty sure that changes related to HSEARCH-2055 In Progress will force us to streamline a bit more how we build Elasticsearch queries (most notably to handle projections in a more generic and extensible way).
- And even more importantly, we'll need to implement parts of Elasticsearch queries differently depending on the Elasticsearch version we're targeting eventually.
Actually we already do in HSEARCH-2603 Closed , but that ticket is too insignificant to justify such a massive refactoring (I'll probably just introduce the Façade with only one simple method, leaving the actual refactoring for later). Still, it's only a matter of time before we really need it.
Some examples of what should probably be moved out of ElasticsearchHSQuery:
- projection handling (creation of FieldProjection objects while populating the JsonObject representing the Elasticsearch query)
- facet request building