12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- [[indices-seal]]
- == Seal
- The seal API flushes and adds a "seal" marker to the shards of one or more
- indices. The seal is used during recovery or restarts to skip the first and
- most costly phase of the process if all copies of the shard have the same seal.
- No segment files need to be copied and the transaction log replay phase of the
- recovery can start immediately which makes recovery much faster.
- There are two important points about seals:
- 1. They are best effort in that if there are any outstanding write operations
- while the seal operation is being performed then the shards which those writes
- target won't be sealed but all others will be. See below for more.
- 2. The seal breaks as soon as the shard issues a new lucene commit. Uncommitted
- operations in the transaction log do not break the seal. That is because a seal
- marks a point in time snapshot of the segments, a low level lucene commit.
- Practically that means that every write operation on the index will remove the
- seal.
- [source,bash]
- --------------------------------------------------
- $ curl -XPOST 'http://localhost:9200/twitter/_seal'
- --------------------------------------------------
- The response contains details about which shards wrote the seal and the reason
- in case they failed to write the seal.
- Here is what it looks like when all copies single shard index successfully
- wrote the seal:
- [source,js]
- --------------------------------------------------
- {
- "twitter": [
- {
- "shard_id": 0,
- "responses": {
- "5wjOIntuRqy9F_7JRrrLwA": "success",
- "M2iCBe-nS5yaInE8volfSg": "success"
- },
- "message": "success"
- }
- }
- --------------------------------------------------
- Here is what it looks like when one copy fails:
- [source,js]
- --------------------------------------------------
- {
- "twitter": [
- {
- "shard_id": 0,
- "responses": {
- "M2iCBe-nS5yaInE8volfSg": "pending operations",
- "5wjOIntuRqy9F_7JRrrLwA": "success"
- },
- "message": "failed on some copies"
- }
- }
- --------------------------------------------------
- Sometimes the failures can be shard wide and they'll look like this:
- [source,js]
- --------------------------------------------------
- {
- "twitter": [
- {
- "shard_id": 0,
- "message": "operation counter on primary is non zero [2]"
- }
- }
- --------------------------------------------------
- [float]
- [[seal-multi-index]]
- === Multi Index
- The seal API can be applied to more than one index with a single call,
- or even on `_all` the indices.
- [source,js]
- --------------------------------------------------
- curl -XPOST 'http://localhost:9200/kimchy,elasticsearch/_seal'
- curl -XPOST 'http://localhost:9200/_seal'
- --------------------------------------------------
|