Let me explain you our percolator architecture
Our percolator docs look like this
{
"domain": <>,
"query": { .. }
}
We have around 100K percolators registered. The number of percolators between domains can vary a lot. Whenever we percolate a document, we want to percolate only against the domains for which the given document is part of
In 1.7, we made use of meta filters and filtered out percolators
When we migrated to 7.2 with similar architecture, the performance degraded drastically
The query we hit was
{
"query": {
"bool": {
"filter": [
{ "term": { "domain": <> } },
{ "percolate": { "document": {...} } }
]
}
}
}
FYI we have few queries in which ES failed to extract terms (around 3000)
I ran the profiler API against the above query and what I saw was the following execution
– PercolateQuery
– CoveringQuery
– TermQuery [query.extraction_result:failed]
– TermQuery [on domain]
I'd like to know how does the PercolateQuery
actually runs? Like in my query above, when will the domain filter be applied? Before or after the document has been tested against the potential candidates? Because the above query clearly isn't making use of the meta filters IMO
Would you suggest that the domain filter be put inside the percolator query itself so that ES can extract it out during registration and hence make a better decision during percolation?
We did that eventually and did see a performance improvement. What surprised me was, just providing the domain gave a performance boost. we had few other meta's as well that we thought of injecting in the percolator query in the hopes that the candidate queries would reduce further. But when we added more such terms, the performance degraded again. Any idea why would that be? Unlike domain, the other filters don't have a lot of distinct values [maybe 2-3]
Also what about queries that ES couldn't extract upon? They get executed blindly always? I guess in that case, it makes sense to put the meta filters inside the percolator query itself. Let me know why adding more meta filters could degrade performance
I suspect it has to do with the way CoveringQuery
works. I'm not really sure though. Could you explain?