norms.asciidoc 2.0 KB

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