Shrinking an index
The latest version of Elasticsearch provides a new way to optimize the index, via the shrink API it's possible to reduce the number of shards of an index.
This feature targets several common scenarios:
The wrong number of shards during the initial design sizing. Often sizing the shards without knowing the correct data/text distribution tends to oversize the number of shards
Reducing the number of shards to reduce memory and resource usage
Reducing the number of shards to speed up searching
Getting ready
You need an up-and-running Elasticsearch installation, as used in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
To correctly execute the following commands, use the index created in the Creating an index recipe.
How to do it...
The HTTP method used is POST
. The URL format for optimizing one or more indices, is:
http://<server>/<source_index_name...