store.asciidoc 4.9 KB

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