store.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. [[default_fs]]`default_fs` deprecated[5.0.0, The `default_fs` store type is deprecated - use `fs` instead]::
  53. The `default` type is deprecated and is aliased to `fs` for backward
  54. compatibility.
  55. === Pre-loading data into the file system cache
  56. NOTE: This is an expert setting, the details of which may change in the future.
  57. By default, elasticsearch completely relies on the operating system file system
  58. cache for caching I/O operations. It is possible to set `index.store.preload`
  59. in order to tell the operating system to load the content of hot index
  60. files into memory upon opening. This setting accept a comma-separated list of
  61. files extensions: all files whose extension is in the list will be pre-loaded
  62. upon opening. This can be useful to improve search performance of an index,
  63. especially when the host operating system is restarted, since this causes the
  64. file system cache to be trashed. However note that this may slow down the
  65. opening of indices, as they will only become available after data have been
  66. loaded into physical memory.
  67. This setting is best-effort only and may not work at all depending on the store
  68. type and host operating system.
  69. The `index.store.preload` is a static setting that can either be set in the
  70. `config/elasticsearch.yml`:
  71. [source,yaml]
  72. ---------------------------------
  73. index.store.preload: ["nvd", "dvd"]
  74. ---------------------------------
  75. or in the index settings at index creation time:
  76. [source,js]
  77. ---------------------------------
  78. PUT /my_index
  79. {
  80. "settings": {
  81. "index.store.preload": ["nvd", "dvd"]
  82. }
  83. }
  84. ---------------------------------
  85. // CONSOLE
  86. The default value is the empty array, which means that nothing will be loaded
  87. into the file-system cache eagerly. For indices that are actively searched,
  88. you might want to set it to `["nvd", "dvd"]`, which will cause norms and doc
  89. values to be loaded eagerly into physical memory. These are the two first
  90. extensions to look at since elasticsearch performs random access on them.
  91. A wildcard can be used in order to indicate that all files should be preloaded:
  92. `index.store.preload: ["*"]`. Note however that it is generally not useful to
  93. load all files into memory, in particular those for stored fields and term
  94. vectors, so a better option might be to set it to
  95. `["nvd", "dvd", "tim", "doc", "dim"]`, which will preload norms, doc values,
  96. terms dictionaries, postings lists and points, which are the most important
  97. parts of the index for search and aggregations.
  98. Note that this setting can be dangerous on indices that are larger than the size
  99. of the main memory of the host, as it would cause the filesystem cache to be
  100. trashed upon reopens after large merges, which would make indexing and searching
  101. _slower_.