I'm writing a high level query parser to go from something like
a AND (b OR c) to a DSL object. My implementation would flatten
a AND (b OR c) to
(a AND b) OR (a and c). From here, the translation to query DSL would be fairly straightforward. Its just ORing ANDs together.
In the above example, if the
a term is complex like a geoquery, i'm assuming elasticsearch will run the geoquery twice. Is this true? If so, I will need to rethink my parsers implementation.
Why do you want to expand queries in this way? The term appearing twice will indeed cause it to match independently (which can be expensive).
Why do you want to expand queries in this way?
I'm using a boolean parser module that flattens it to this structure. I could maintain the original structure, however that would mean i would have to write my own boolean parser. By using this module, I only have to write the validation for each boolean term (ie if the path/operator/value work together).
Anyways, thanks for the confirmation that this would be expensive. Going forward I'm just going to restrict the types of queries that would be within this string to simple term/range/equality comparisons. I'll leave the more complex terms like geo in their own separate clauses.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.