sealedit

Summaryedit

This feature requires Elasticsearch version 1.6.0+ and Curator 3.2.0

From the Elasticsearch Synced Flush API documentation

Elasticsearch tracks the indexing activity of each shard. Shards that have not received any indexing operations for 5 minutes are automatically marked as inactive. This presents an opportunity for Elasticsearch to reduce shard resources and also perform a special kind of flush, called synced flush. A synced flush performs a normal flush, then adds a generated unique marker (sync_id) to all shards.

Since the sync id marker was added when there were no ongoing indexing operations, it can be used as a quick way to check if the two shards' lucene indices are identical. This quick sync id comparison (if present) is used during recovery or restarts to skip the first and most costly phase of the process. In that case, no segment files need to be copied and the transaction log replay phase of the recovery can start immediately. Note that since the sync id marker was applied together with a flush, it is very likely that the transaction log will be empty, speeding up recoveries even more.

This is particularly useful for use cases having lots of indices which are never or very rarely updated, such as time based data. This use case typically generates lots of indices whose recovery without the synced flush marker would take a long time.

…​

The Synced Flush API allows an administrator to initiate a synced flush manually. This can be particularly useful for a planned (rolling) cluster restart where you can stop indexing and don’t want to wait the default 5 minutes for idle indices to be sync-flushed automatically.

 

As mentioned, Elasticsearch will automatically seal indices after 5 minutes of inactivity. This command is here for times when you might need to manually seal (synced flush) an index. This command is also performed when closing indices.

From the Elasticsearch Synced Flush API documentation:

Synced flush is a best effort operation. Any ongoing indexing operations will cause the synced flush to fail on that shard. This means that some shards may be synced flushed while others aren’t.

 

and also:

It is harmless to request a synced flush while there is ongoing indexing. Shards that are idle will succeed and shards that are not will fail. Any shards that succeeded will have faster recovery times.

The seal command will always exit successfully, even if all shards fail the synced flush. As a result, you must pay attention to the logs to see which indices (and which shards) may have failed. All reasons for the failure which are returned will be logged with the correlating index name.

Flagsedit

$ curator seal --help
Usage: curator seal [OPTIONS] COMMAND [ARGS]...


  Seal indices (Synced flush: ES 1.6.0+ only)

Options:
  --help  Show this message and exit.

Commands:
  indices  Index selection.

 

This command requires the indices subcommand for index selection.

Exampleedit

Seal matching indices:

curator seal indices <<index selection parameters>>