Change term filter into match query - #89
Conversation
|
I think I prefer the direction you're going in #88. This exposes more of elasticsearch's complexity through to the search API, but I'm not exactly clear on the user story. |
|
I prefer #88 too. I rather have a very predictable default. |
|
I realised that also when using choosing to default to exact matches, it is still totally possible to - and there is still reason to - use a |
|
They are definitely slower because the analysis step is performed. I don't think that's a problem. |
581f8a9 to
14a1b00
Compare
|
@Treora: A quick question here. I've checked the generated query, i.e. And I don't think we should include the match_all if we have query k,v values to the generated query. |
|
Yes perhaps that is a nicer solution indeed. Fixed. |
|
LGTM 👍 |
|
This is looking pretty good, but I'm slightly nervous about merging this without any idea of what the performance impact is. Running the analysers on search seems like it could potentially be a pretty big overhead. I don't suppose either of you would be up for loading a test corpus and benchmarking an equivalent search before and after, would you? |
|
@nickstenning: I agree that it can be an overhead, but it really depends on the analyzer. A wrongly-declared analyzer can be very slow, but my gutt feeling is, that, in normal cases, analyzing the search terms is not that costly. (Because the data in which we're searching is already indexed so alreay tokenized, and match query is just an inverse index lookup for the data) But, if we want to make performance tests, we can maybe use this ES benchmark component |
|
I don't expect a significant performance impact, because the default analyser is Of course, when different analysers are being specified, performance will change. But being able to specify different analysers is exactly the thing we want to enable with this PR. |
|
👍 to what @Treora said. |
|
In which case... |
Change term filter into match query
Another approach to issue #73, using the idea suggested in #77: instead of using a
filterwith exactterms, the approach is now to use amatchquery. This way fields by default are still analyzed when indexed (unlike in #88), but now queries are analyzed too. Search on any field that is not set to benot_analyzedin the mapping will do a case-insensitive full text search:search?myfield=Alicewill return annotations with myfield valuealicesearch?myfield=blawill return annotations with myfield valuebla bla(by the way, ignore the changes in
annotation.py, they're just adaptation to the new query structure (although being more code than the main change))