We're updating the issue view to help you get more done. 

Move Elasticsearch query building (ToElasticsearch, parts of ElasticsearchHSQueryImpl) to a non-static object in ElasticsearchService

Description

Rationale:

  1. There's way too much code in ElasticsearchHSQueryImpl, we should split it into smaller class to make it easier to understand/maintain

  2. I'm pretty sure that changes related to 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).

  3. 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, 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

  • filtering

  • sorts

  • ...

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Priority

Major