2013-08-28 19:24:34 -04:00
|
|
|
[[index-modules-store]]
|
|
|
|
== Store
|
|
|
|
|
2015-02-04 09:43:22 -05:00
|
|
|
experimental[]
|
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
The store module allows you to control how index data is stored.
|
|
|
|
|
|
|
|
The index can either be stored in-memory (no persistence) or on-disk
|
|
|
|
(the default). In-memory indices provide better performance at the cost
|
|
|
|
of limiting the index size to the amount of available physical memory.
|
|
|
|
|
|
|
|
When using a local gateway (the default), file system storage with *no*
|
|
|
|
in memory storage is required to maintain index consistency. This is
|
|
|
|
required since the local gateway constructs its state from the local
|
|
|
|
index state of each node.
|
|
|
|
|
|
|
|
Another important aspect of memory based storage is the fact that
|
2014-01-06 15:58:46 -05:00
|
|
|
Elasticsearch supports storing the index in memory *outside of the JVM
|
2013-08-28 19:24:34 -04:00
|
|
|
heap space* using the "Memory" (see below) storage type. It translates
|
|
|
|
to the fact that there is no need for extra large JVM heaps (with their
|
|
|
|
own consequences) for storing the index in memory.
|
|
|
|
|
2015-01-14 05:35:09 -05:00
|
|
|
|
2013-08-28 19:24:34 -04:00
|
|
|
[float]
|
2013-09-25 12:17:40 -04:00
|
|
|
[[file-system]]
|
2014-06-12 07:56:06 -04:00
|
|
|
=== File system storage types
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
File system based storage is the default storage used. There are
|
2014-06-12 07:56:06 -04:00
|
|
|
different implementations or _storage types_. The best one for the
|
2013-08-28 19:24:34 -04:00
|
|
|
operating environment will be automatically chosen: `mmapfs` on
|
2014-06-26 16:46:21 -04:00
|
|
|
Windows 64bit, `simplefs` on Windows 32bit, and `default`
|
|
|
|
(hybrid `niofs` and `mmapfs`) for the rest.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2014-06-12 07:56:06 -04:00
|
|
|
This can be overridden for all indices by adding this to the
|
|
|
|
`config/elasticsearch.yml` file:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
---------------------------------
|
|
|
|
index.store.type: niofs
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
It can also be set on a per-index basis at index creation time:
|
|
|
|
|
|
|
|
[source,json]
|
|
|
|
---------------------------------
|
2014-07-23 06:40:13 -04:00
|
|
|
curl -XPUT localhost:9200/my_index -d '{
|
2014-06-12 07:56:06 -04:00
|
|
|
"settings": {
|
|
|
|
"index.store.type": "niofs"
|
|
|
|
}
|
2014-07-23 06:40:13 -04:00
|
|
|
}';
|
2014-06-12 07:56:06 -04:00
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
The following sections lists all the different storage types supported.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
[float]
|
2014-06-12 07:56:06 -04:00
|
|
|
[[simplefs]]
|
2013-08-28 19:24:34 -04:00
|
|
|
==== Simple FS
|
|
|
|
|
|
|
|
The `simplefs` type is a straightforward implementation of file system
|
|
|
|
storage (maps to Lucene `SimpleFsDirectory`) using a random access file.
|
|
|
|
This implementation has poor concurrent performance (multiple threads
|
|
|
|
will bottleneck). It is usually better to use the `niofs` when you need
|
|
|
|
index persistence.
|
|
|
|
|
|
|
|
[float]
|
2014-06-12 07:56:06 -04:00
|
|
|
[[niofs]]
|
2013-08-28 19:24:34 -04:00
|
|
|
==== NIO FS
|
|
|
|
|
|
|
|
The `niofs` type stores the shard index on the file system (maps to
|
|
|
|
Lucene `NIOFSDirectory`) using NIO. It allows multiple threads to read
|
|
|
|
from the same file concurrently. It is not recommended on Windows
|
|
|
|
because of a bug in the SUN Java implementation.
|
|
|
|
|
2014-01-15 11:50:24 -05:00
|
|
|
[[mmapfs]]
|
2013-08-28 19:24:34 -04:00
|
|
|
[float]
|
|
|
|
==== MMap FS
|
|
|
|
|
|
|
|
The `mmapfs` type stores the shard index on the file system (maps to
|
|
|
|
Lucene `MMapDirectory`) by mapping a file into memory (mmap). Memory
|
|
|
|
mapping uses up a portion of the virtual memory address space in your
|
|
|
|
process equal to the size of the file being mapped. Before using this
|
|
|
|
class, be sure your have plenty of virtual address space.
|
2014-06-12 07:56:06 -04:00
|
|
|
See <<vm-max-map-count>>
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2014-06-26 16:46:21 -04:00
|
|
|
[[default_fs]]
|
|
|
|
[float]
|
2014-09-26 15:04:42 -04:00
|
|
|
==== Hybrid MMap / NIO FS
|
2014-06-26 16:46:21 -04:00
|
|
|
|
|
|
|
The `default` type stores the shard index on the file system depending on
|
|
|
|
the file type by mapping a file into memory (mmap) or using Java NIO. Currently
|
|
|
|
only the Lucene term dictionary and doc values files are memory mapped to reduce
|
|
|
|
the impact on the operating system. All other files are opened using Lucene `NIOFSDirectory`.
|
2014-07-10 02:46:57 -04:00
|
|
|
Address space settings (<<vm-max-map-count>>) might also apply if your term
|
2014-06-26 16:46:21 -04:00
|
|
|
dictionaries are large.
|
|
|
|
|