store.asciidoc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. [[index-modules-store]]
  2. == Store
  3. The store module allows you to control how index data is stored and accessed on disk.
  4. NOTE: This is a low-level setting. Some store implementations have poor
  5. concurrency or disable optimizations for heap memory usage. We recommend
  6. sticking to the defaults.
  7. [discrete]
  8. [[file-system]]
  9. === File system storage types
  10. There are different file system implementations or _storage types_. By default,
  11. Elasticsearch will pick the best implementation based on the operating
  12. environment.
  13. The storage type can also be explicitly set for all indices by configuring the
  14. store type in the `config/elasticsearch.yml` file:
  15. [source,yaml]
  16. ---------------------------------
  17. index.store.type: hybridfs
  18. ---------------------------------
  19. It is a _static_ setting that can be set on a per-index basis at index
  20. creation time:
  21. [source,console]
  22. ---------------------------------
  23. PUT /my-index-000001
  24. {
  25. "settings": {
  26. "index.store.type": "hybridfs"
  27. }
  28. }
  29. ---------------------------------
  30. WARNING: This is an expert-only setting and may be removed in the future.
  31. The following sections lists all the different storage types supported.
  32. `fs`::
  33. Default file system implementation. This will pick the best implementation
  34. depending on the operating environment, which is currently `hybridfs` on all
  35. supported systems but is subject to change.
  36. [[simplefs]]`simplefs`::
  37. The Simple FS type is a straightforward implementation of file system
  38. storage (maps to Lucene `SimpleFsDirectory`) using a random access file.
  39. This implementation has poor concurrent performance (multiple threads
  40. will bottleneck) and disables some optimizations for heap memory usage.
  41. [[niofs]]`niofs`::
  42. The NIO FS type stores the shard index on the file system (maps to
  43. Lucene `NIOFSDirectory`) using NIO. It allows multiple threads to read
  44. from the same file concurrently. It is not recommended on Windows
  45. because of a bug in the SUN Java implementation and disables some
  46. optimizations for heap memory usage.
  47. [[mmapfs]]`mmapfs`::
  48. The MMap FS type stores the shard index on the file system (maps to
  49. Lucene `MMapDirectory`) by mapping a file into memory (mmap). Memory
  50. mapping uses up a portion of the virtual memory address space in your
  51. process equal to the size of the file being mapped. Before using this
  52. class, be sure you have allowed plenty of
  53. <<vm-max-map-count,virtual address space>>.
  54. [[hybridfs]]`hybridfs`::
  55. The `hybridfs` type is a hybrid of `niofs` and `mmapfs`, which chooses the best
  56. file system type for each type of file based on the read access pattern.
  57. Currently only the Lucene term dictionary, norms and doc values files are
  58. memory mapped. All other files are opened using Lucene `NIOFSDirectory`.
  59. Similarly to `mmapfs` be sure you have allowed plenty of
  60. <<vm-max-map-count,virtual address space>>.
  61. [[allow-mmap]]
  62. You can restrict the use of the `mmapfs` and the related `hybridfs` store type
  63. via the setting `node.store.allow_mmap`. This is a boolean setting indicating
  64. whether or not memory-mapping is allowed. The default is to allow it. This
  65. setting is useful, for example, if you are in an environment where you can not
  66. control the ability to create a lot of memory maps so you need disable the
  67. ability to use memory-mapping.
  68. [[preload-data-to-file-system-cache]]
  69. === Preloading data into the file system cache
  70. NOTE: This is an expert setting, the details of which may change in the future.
  71. By default, Elasticsearch completely relies on the operating system file system
  72. cache for caching I/O operations. It is possible to set `index.store.preload`
  73. in order to tell the operating system to load the content of hot index
  74. files into memory upon opening. This setting accept a comma-separated list of
  75. files extensions: all files whose extension is in the list will be pre-loaded
  76. upon opening. This can be useful to improve search performance of an index,
  77. especially when the host operating system is restarted, since this causes the
  78. file system cache to be trashed. However note that this may slow down the
  79. opening of indices, as they will only become available after data have been
  80. loaded into physical memory.
  81. This setting is best-effort only and may not work at all depending on the store
  82. type and host operating system.
  83. The `index.store.preload` is a static setting that can either be set in the
  84. `config/elasticsearch.yml`:
  85. [source,yaml]
  86. ---------------------------------
  87. index.store.preload: ["nvd", "dvd"]
  88. ---------------------------------
  89. or in the index settings at index creation time:
  90. [source,console]
  91. ---------------------------------
  92. PUT /my-index-000001
  93. {
  94. "settings": {
  95. "index.store.preload": ["nvd", "dvd"]
  96. }
  97. }
  98. ---------------------------------
  99. The default value is the empty array, which means that nothing will be loaded
  100. into the file-system cache eagerly. For indices that are actively searched,
  101. you might want to set it to `["nvd", "dvd"]`, which will cause norms and doc
  102. values to be loaded eagerly into physical memory. These are the two first
  103. extensions to look at since Elasticsearch performs random access on them.
  104. A wildcard can be used in order to indicate that all files should be preloaded:
  105. `index.store.preload: ["*"]`. Note however that it is generally not useful to
  106. load all files into memory, in particular those for stored fields and term
  107. vectors, so a better option might be to set it to
  108. `["nvd", "dvd", "tim", "doc", "dim"]`, which will preload norms, doc values,
  109. terms dictionaries, postings lists and points, which are the most important
  110. parts of the index for search and aggregations.
  111. Note that this setting can be dangerous on indices that are larger than the size
  112. of the main memory of the host, as it would cause the filesystem cache to be
  113. trashed upon reopens after large merges, which would make indexing and searching
  114. _slower_.