Hey guys,
Does anyone know where is the part of the ElasticSearch code that has the behavior of term query with analyzer?
"Queries like the term or fuzzy queries are low-level queries that have no
analysis phase. They operate on a single term. A term query for the term
Foo looks for that exact term in the inverted index and calculates the
TF/IDF relevance _score for each document that contains the term.It is important to remember that the term query looks in the inverted index
for the exact term only; it won’t match any variants like foo or
FOO. It doesn’t matter how the term came to be in the index, just that it
is. If you were to index ["Foo","Bar"] into an exact value not_analyzed
field, or Foo Bar into an analyzed field with the whitespace analyzer,
both would result in having the two terms Foo and Bar in the inverted
index."
Just wanted to understand a bit better by reading the code.
The documentation you pasted describes the fact that term
query does not use an analyzer so I can't point you at any code for term
query with analyzer.
If you want your search input to be analyzed consider using the match
query which offers field-sensitive analysis.
Thank you for your time to reply. from what I understood. If you are using the default analyzer (standard) and you inserted a data with name uppercase for example like TEST and I do a query term looking for TEST it won't find anything because the query looks for the analyzed result which is "test". I wanted to find the part of the code that shows that it queries the already analyzed value.
Generally, parsers turn user-criteria into Query objects which are part of Apache Lucene (the open source search engine we help maintain). That rabbit-hole goes quite deep so maybe a better starting point is to look at the explain
api which shows the low-level terms that are being generated by the Lucene Query objects.