8bdc7362a6
QueryBuilders today do all their heavy lifting in toQuery() which can be too late for several operations. For instance if we want to fetch geo shapes on the coordinating node we need to do all this before we create the actual lucene query which happens on the shard itself. Also optimizations for request caching need to be done to the query builder rather than the query which then in-turn needs to be serialized again. This commit adds the basic infrastructure for query rewriting and moves the heavy lifting into the rewrite method for the following queries: * `WrapperQueryBuilder` * `GeoShapeQueryBuilder` * `TermsQueryBuilder` * `TemplateQueryBuilder` Other queries like `MoreLikeThisQueryBuilder` still need to be fixed / converted. The nice sideeffect of this is that queries like template queries will now also match the request cache if their non-template equivalent has been cached befoore. In the future this will allow to add optimizataion like rewriting time-based queries into primitives like `match_all_docs` or `match_no_docs` based on the currents shards bounds. This is especially appealing for indices that are read-only ie. never change. |
||
---|---|---|
.. | ||
licenses | ||
src | ||
build.gradle |