elasticsearch/elasticsearch — pull request #9033 by dakrone (2014-12-22 16:30:09+00:00)
Title: Add index.data_path setting

(This is a fixed version of #8819, which had a lot of test failures and was subsequently reverted. The failures were partially related to ddf83a90dd59df7c58aedd3dd8710760ed66bb3b, which was not properly injecting the right settings into the MockFSIndexStore. It also fixes some state file overwriting that occurred on Windows by making the custom path logic less invasive)

This allows specifying the path an index will be at.

`index.data_path` is specified in the settings when creating an index,
and can not be dynamically changed.

An example request would look like:

```json
POST /myindex
{
"settings": {
"number_of_shards": 2,
"data_path": "/tmp/myindex"
}
}
```

And would put data in `/tmp/myindex/0/index/0` and `/tmp/myindex/0/index/1`.
Note that index and shard state is still written to the node's `path.data`
directory, because we use this for internal accounting (though this may
change in a subsequent shadow-replica-related PR)

Since this can be used to write data to arbitrary locations on disk, it
requires enabling the `node.enable_custom_paths` setting in
elasticsearch.yml on all nodes.

Relates to #8976