Could somebody help me understand the difference between a term query and a
match query? I saw the explanation on the elasticsearch site but couldn't
quite follow. Isn't search always trying to match terms?
The match query analyzes the input string and constructs more basic queries
from that.
The term query matches exact terms.
If you have a document containing "CAT" and search for "cat" the match
query will find it but the term query won't. That is, if you lowercase in
your analysis config which it does by default.
Could somebody help me understand the difference between a term query and
a match query? I saw the explanation on the elasticsearch site but couldn't
quite follow. Isn't search always trying to match terms?
Thanks that helps! Is analysis mostly based off the lower/upper case? Or
does it also breaks a text into multiple individual terms?
On Mon, Nov 18, 2013 at 5:14 PM, Nikolas Everett nik9000@gmail.com wrote:
The match query analyzes the input string and constructs more basic
queries from that.
The term query matches exact terms.
If you have a document containing "CAT" and search for "cat" the match
query will find it but the term query won't. That is, if you lowercase in
your analysis config which it does by default.
Could somebody help me understand the difference between a term query and
a match query? I saw the explanation on the elasticsearch site but couldn't
quite follow. Isn't search always trying to match terms?
Both. And stemming if your field has that. And stopwords. It uses the configured query analyzer for that field which defaults to the index analyzer for that field which defaults to the "standard" analyzer.
For non strings match will parse strings into that type.
It can do more stuff too but you can read about that on the page.
Thanks that helps! Is analysis mostly based off the lower/upper case? Or does it also breaks a text into multiple individual terms?
On Mon, Nov 18, 2013 at 5:14 PM, Nikolas Everett nik9000@gmail.com wrote:
The match query analyzes the input string and constructs more basic queries from that.
The term query matches exact terms.
If you have a document containing "CAT" and search for "cat" the match query will find it but the term query won't. That is, if you lowercase in your analysis config which it does by default.
On Mon, Nov 18, 2013 at 8:11 PM, Mohit Anchlia mohitanchlia@gmail.com wrote:
Could somebody help me understand the difference between a term query and a match query? I saw the explanation on the elasticsearch site but couldn't quite follow. Isn't search always trying to match terms?
Yes, term query is going to be a bit faster but for user provided text you really need to analyze it for the queries to work properly. I mostly use term queries for keyword style fields where analysis doesn't make sense. Like if I user is picking from a drop down or ticking a box or something.
Thanks, Nik. That makes sense. I guess match query could be used for full-text search where user might not input the exact keyword, but a variant of the search term such as "Fox", "fox, and "foxes" in the search field.
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.