What is a good use case of the omit_norms
option in elasticsearch? I could not find adequate explanation in es website.
问题:
回答1:
Norms are a value stored in the index alongside a field, and used for scoring. With the default scoring algorithm, this combines a lengthNorm
(which serves to weigh short fields more heavily than long ones), and any field-level boosts. You can see more on the details of it in the Lucene documentation.
The LengthNorm aspect is mostly helpful on proper full-text fields. On more structured fields in which you don't need a field boost, you can safely omit them.
回答2:
Norms are enabled by default for all analyzed fields as they're used for scoring. Put in simple words, they make shorter fields get higher score than longer ones. Whenever one doesn't want that or don't want a field to contribute to _score
, one could disable norms.
From Elastic 2.0 onwards, you could add "norms": { "enabled": false }
while defining the field in the mapping.
For use cases such as logging, norms are not useful.
More details can be found in this article in elastic guide