In a term
query, the searched term (i.e. hello
) is not analyzed and is matched exactly as is against the terms present in the inverted index.
In a match
query, the searched term (i.e. hello
) is analyzed first and then matched against the terms present in the inverted index.
In your case, since hostname
is not_analyzed
in your mapping, your first choice should be to use a term
query since it makes no sense to analyze a term at search time for searching the same term that hasn't been analyzed in the first place at indexing time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…