store.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. experimental[This is an expert-only setting and may be removed in the future]
  28. The following sections lists all the different storage types supported.
  29. `fs`::
  30. Default file system implementation. This will pick the best implementation
  31. depending on the operating environment: `simplefs` on Windows 32bit, `niofs`
  32. on other 32bit systems and `mmapfs` on 64bit systems.
  33. [[simplefs]]`simplefs`::
  34. The Simple FS type is a straightforward implementation of file system
  35. storage (maps to Lucene `SimpleFsDirectory`) using a random access file.
  36. This implementation has poor concurrent performance (multiple threads
  37. will bottleneck). It is usually better to use the `niofs` when you need
  38. index persistence.
  39. [[niofs]]`niofs`::
  40. The NIO FS type stores the shard index on the file system (maps to
  41. Lucene `NIOFSDirectory`) using NIO. It allows multiple threads to read
  42. from the same file concurrently. It is not recommended on Windows
  43. because of a bug in the SUN Java implementation.
  44. [[mmapfs]]`mmapfs`::
  45. The MMap FS type stores the shard index on the file system (maps to
  46. Lucene `MMapDirectory`) by mapping a file into memory (mmap). Memory
  47. mapping uses up a portion of the virtual memory address space in your
  48. process equal to the size of the file being mapped. Before using this
  49. class, be sure you have allowed plenty of
  50. <<vm-max-map-count,virtual address space>>.
  51. [[default_fs]]`default_fs` deprecated[5.0.0, The `default_fs` store type is deprecated - use `fs` instead]::
  52. The `default` type is deprecated and is aliased to `fs` for backward
  53. compatibility.
  54. === Pre-loading data into the file system cache
  55. experimental[This is an expert-only setting and may be removed in the future]
  56. By default, elasticsearch completely relies on the operating system file system
  57. cache for caching I/O operations. It is possible to set `index.store.preload`
  58. in order to tell the operating system to load the content of hot index
  59. files into memory upon opening. This setting accept a comma-separated list of
  60. files extensions: all files whose extension is in the list will be pre-loaded
  61. upon opening. This can be useful to improve search performance of an index,
  62. especially when the host operating system is restarted, since this causes the
  63. file system cache to be trashed. However note that this may slow down the
  64. opening of indices, as they will only become available after data have been
  65. loaded into physical memory.
  66. This setting is best-effort only and may not work at all depending on the store
  67. type and host operating system.
  68. The `index.store.pre_load` is a static setting that can either be set in the
  69. `config/elasticsearch.yml`:
  70. [source,yaml]
  71. ---------------------------------
  72. index.store.pre_load: ["nvd", "dvd"]
  73. ---------------------------------
  74. or in the index settings at index creation time:
  75. [source,js]
  76. ---------------------------------
  77. PUT /my_index
  78. {
  79. "settings": {
  80. "index.store.pre_load": ["nvd", "dvd"]
  81. }
  82. }
  83. ---------------------------------
  84. The default value is the empty array, which means that nothing will be loaded
  85. into the file-system cache eagerly. For indices that are actively searched,
  86. you might want to set it to `["nvd", "dvd"]`, which will cause norms and doc
  87. values to be loaded eagerly into physical memory. These are the two first
  88. extensions to look at since elasticsearch performs random access on them.
  89. A wildcard can be used in order to indicate that all files should be preloaded:
  90. `index.store.pre_load: ["*"]`. Note however that it is generally not useful to
  91. load all files into memory, in particular those for stored fields and term
  92. vectors, so a better option might be to set it to
  93. `["nvd", "dvd", "tim", "doc", "dim"]`, which will preload norms, doc values,
  94. terms dictionaries, postings lists and points, which are the most important
  95. parts of the index for search and aggregations.
  96. Note that this setting can be dangerous on indices that are larger than the size
  97. of the main memory of the host, as it would cause the filesystem cache to be
  98. trashed upon reopens after large merges, which would make indexing and searching
  99. _slower_.