Skip to content

Refactor parsing of queries/filters, aggs, suggester APIs #10217

@clintongormley

Description

@clintongormley

Copied from #9901:

Today we have a massive infrastructure to parse all our requests. We have client side builders and server side parsers but no real representation of the query, filter, aggregation etc until it's executed. What is produced from a XContent binary is a Lucene query directly which causes huge parse methods in separate classes etc. that hare hard to test and don't allow decoupled modifications or actions on the query itself between parsing and executing.

This refactoring splits the parsing and the creation of the lucene query, this has a couple of advantages

  • XContent parsing creation are in one file and can be tested more easily
  • the class allows a typed in-memory representation of the query that can be modified before a lucene query is build
  • the query can be normalized and serialized via Streamable to be used as a normalized cache key (not depending on the order of the keys in the XContent)
  • the query can be parsed on the coordinating node to allow document prefetching etc. forwarding to the executing nodes would work via Streamable binary representation --> Should we parse search requests on the coordinating node? #8150
  • for the query cache a query tree can be "walked" to rewrite range queries into match all queries with MIN/MAX terms to get cache hits for sliding windows --> Kibana 4 unable to utilize query cache #9526
  • code wise two classes are merged into one which is nice

Queries (Completed)

Total of 54 Queries
54 done

Former filters were mostly merged or converted to queries and are included in this list.

Aggregations (Completed - #14136)

Total of 44 Aggregations
44 done

Suggesters

  • Term suggester
  • Phrase Suggester
  • Completion Suggester
  • Context Suggester

Total of 4 Suggesters
4 done, 0 in open PRs

Highlighters

  • plain
  • fvh
  • postings

Total of 3 Highlighters
3 done

Others

APIs to be adapted/revised besides _search

The above apis don't necessarily have to change to parse queries in our intermediate format, for instance the percolator will still need to parse to lucene query straight-away, but we should still have a look at each of those and double check if anything needs to be adjusted after all the infra changes we have made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions