I've created a few variations of a query and tried out different searching approaches, I seem to be getting the same results, so it got me wondering are there any differences (e.g. performance wise) between the following:
yes, there are, because the first and last query searches for terms that contain laptop anywhere in their string (potentially causing the check out all the terms in an index), where as the second variant just searches for documents containing the word laptop as a whole. The difference can be massive.
Yeah, the second works the same no matter if I add asterisks or not, so I left it out.
Lets ignore the match query then, between the query_string and wildcard query, is there any difference except the syntax? Which one is faster?
no, not really. Both are going can be slow on bigger datasets. You might want to look into ngrams, edgengrams or the compound token filter as soon as you run into speed issues.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.