norms.asciidoc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. [[norms]]
  2. === `norms`
  3. Norms store various normalization factors -- a number to represent the
  4. relative field length and the <<index-boost,index time `boost`>> setting --
  5. that are later used at query time in order to compute the score of a document
  6. relatively to a query.
  7. Although useful for scoring, norms also require quite a lot of memory
  8. (typically in the order of one byte per document per field in your index, even
  9. for documents that don't have this specific field). As a consequence, if you
  10. don't need scoring on a specific field, you should disable norms on that
  11. field. In particular, this is the case for fields that are used solely for
  12. filtering or aggregations.
  13. TIP: The `norms.enabled` setting must have the same setting for fields of the
  14. same name in the same index. Norms can be disabled on existing fields using
  15. the <<indices-put-mapping,PUT mapping API>>.
  16. Norms can be disabled (but not reenabled) after the fact, using the
  17. <<indices-put-mapping,PUT mapping API>> like so:
  18. [source,js]
  19. ------------
  20. PUT my_index/_mapping/my_type
  21. {
  22. "properties": {
  23. "title": {
  24. "type": "string",
  25. "norms": {
  26. "enabled": false
  27. }
  28. }
  29. }
  30. }
  31. ------------
  32. // AUTOSENSE
  33. NOTE: Norms will not be removed instantly, but will be removed as old segments
  34. are merged into new segments as you continue indexing new documents. Any score
  35. computation on a field that has had norms removed might return inconsistent
  36. results since some documents won't have norms anymore while other documents
  37. might still have norms.
  38. ==== Lazy loading of norms
  39. Norms can be loaded into memory eagerly (`eager`), whenever a new segment
  40. comes online, or they can loaded lazily (`lazy`, default), only when the field
  41. is queried.
  42. Eager loading can be configured as follows:
  43. [source,js]
  44. ------------
  45. PUT my_index/_mapping/my_type
  46. {
  47. "properties": {
  48. "title": {
  49. "type": "string",
  50. "norms": {
  51. "loading": "eager"
  52. }
  53. }
  54. }
  55. }
  56. ------------
  57. // AUTOSENSE
  58. TIP: The `norms.loading` setting must have the same setting for fields of the
  59. same name in the same index. Its value can be updated on existing fields
  60. using the <<indices-put-mapping,PUT mapping API>>.