- Elasticsearch Guide: other versions:
- Getting Started
- Setup
- Breaking changes
- Breaking changes in 2.2
- Breaking changes in 2.1
- Breaking changes in 2.0
- Removed features
- Network changes
- Multiple
path.data
striping - Mapping changes
- CRUD and routing changes
- Query DSL changes
- Search changes
- Aggregation changes
- Parent/Child changes
- Scripting changes
- Index API changes
- Snapshot and Restore changes
- Plugin and packaging changes
- Setting changes
- Stats, info, and
cat
changes - Java API changes
- API Conventions
- Document APIs
- Search APIs
- Aggregations
- Metrics Aggregations
- Avg Aggregation
- Cardinality Aggregation
- Extended Stats Aggregation
- Geo Bounds Aggregation
- Geo Centroid Aggregation
- Max Aggregation
- Min Aggregation
- Percentiles Aggregation
- Percentile Ranks Aggregation
- Scripted Metric Aggregation
- Stats Aggregation
- Sum Aggregation
- Top hits Aggregation
- Value Count Aggregation
- Bucket Aggregations
- Children Aggregation
- Date Histogram Aggregation
- Date Range Aggregation
- Filter Aggregation
- Filters Aggregation
- Geo Distance Aggregation
- GeoHash grid Aggregation
- Global Aggregation
- Histogram Aggregation
- IPv4 Range Aggregation
- Missing Aggregation
- Nested Aggregation
- Range Aggregation
- Reverse nested Aggregation
- Sampler Aggregation
- Significant Terms Aggregation
- Terms Aggregation
- Pipeline Aggregations
- Avg Bucket Aggregation
- Derivative Aggregation
- Max Bucket Aggregation
- Min Bucket Aggregation
- Sum Bucket Aggregation
- Stats Bucket Aggregation
- Extended Stats Bucket Aggregation
- Percentiles Bucket Aggregation
- Moving Average Aggregation
- Cumulative Sum Aggregation
- Bucket Script Aggregation
- Bucket Selector Aggregation
- Serial Differencing Aggregation
- Caching heavy aggregations
- Returning only aggregation results
- Aggregation Metadata
- Metrics Aggregations
- Indices APIs
- Create Index
- Delete Index
- Get Index
- Indices Exists
- Open / Close Index API
- Put Mapping
- Get Mapping
- Get Field Mapping
- Types Exists
- Index Aliases
- Update Indices Settings
- Get Settings
- Analyze
- Index Templates
- Warmers
- Shadow replica indices
- Indices Stats
- Indices Segments
- Indices Recovery
- Indices Shard Stores
- Clear Cache
- Flush
- Refresh
- Force Merge
- Optimize
- Upgrade
- cat APIs
- Cluster APIs
- Query DSL
- Mapping
- Field datatypes
- Meta-Fields
- Mapping parameters
analyzer
boost
coerce
copy_to
doc_values
dynamic
enabled
fielddata
format
geohash
geohash_precision
geohash_prefix
ignore_above
ignore_malformed
include_in_all
index
index_options
lat_lon
fields
norms
null_value
position_increment_gap
precision_step
properties
search_analyzer
similarity
store
term_vector
- Dynamic Mapping
- Transform
- Analysis
- Analyzers
- Tokenizers
- Token Filters
- Standard Token Filter
- ASCII Folding Token Filter
- Length Token Filter
- Lowercase Token Filter
- Uppercase Token Filter
- NGram Token Filter
- Edge NGram Token Filter
- Porter Stem Token Filter
- Shingle Token Filter
- Stop Token Filter
- Word Delimiter Token Filter
- Stemmer Token Filter
- Stemmer Override Token Filter
- Keyword Marker Token Filter
- Keyword Repeat Token Filter
- KStem Token Filter
- Snowball Token Filter
- Phonetic Token Filter
- Synonym Token Filter
- Compound Word Token Filter
- Reverse Token Filter
- Elision Token Filter
- Truncate Token Filter
- Unique Token Filter
- Pattern Capture Token Filter
- Pattern Replace Token Filter
- Trim Token Filter
- Limit Token Count Token Filter
- Hunspell Token Filter
- Common Grams Token Filter
- Normalization Token Filter
- CJK Width Token Filter
- CJK Bigram Token Filter
- Delimited Payload Token Filter
- Keep Words Token Filter
- Keep Types Token Filter
- Classic Token Filter
- Apostrophe Token Filter
- Decimal Digit Token Filter
- Character Filters
- Modules
- Index Modules
- Testing
- Glossary of terms
- Release Notes
WARNING: Version 2.2 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
cat shards
editcat shards
editThe shards
command is the detailed view of what nodes contain which
shards. It will tell you if it’s a primary or replica, the number of
docs, the bytes it takes on disk, and the node where it’s located.
Here we see a single index, with three primary shards and no replicas:
% curl 192.168.56.20:9200/_cat/shards wiki1 0 p STARTED 3014 31.1mb 192.168.56.10 Stiletto wiki1 1 p STARTED 3013 29.6mb 192.168.56.30 Frankie Raye wiki1 2 p STARTED 3973 38.1mb 192.168.56.20 Commander Kraken
Index pattern
editIf you have many shards, you may wish to limit which indices show up
in the output. You can always do this with grep
, but you can save
some bandwidth by supplying an index pattern to the end.
% curl 192.168.56.20:9200/_cat/shards/wiki2 wiki2 0 p STARTED 197 3.2mb 192.168.56.10 Stiletto wiki2 1 p STARTED 205 5.9mb 192.168.56.30 Frankie Raye wiki2 2 p STARTED 275 7.8mb 192.168.56.20 Commander Kraken
Relocation
editLet’s say you’ve checked your health and you see two relocating shards. Where are they from and where are they going?
% curl 192.168.56.10:9200/_cat/health 1384315316 20:01:56 foo green 3 3 12 6 2 0 0 % curl 192.168.56.10:9200/_cat/shards | fgrep RELO wiki1 0 r RELOCATING 3014 31.1mb 192.168.56.20 Commander Kraken -> 192.168.56.30 Frankie Raye wiki1 1 r RELOCATING 3013 29.6mb 192.168.56.10 Stiletto -> 192.168.56.30 Frankie Raye
Shard states
editBefore a shard can be used, it goes through an INITIALIZING
state.
shards
can show you which ones.
% curl -XPUT 192.168.56.20:9200/_settings -d'{"number_of_replicas":1}' {"acknowledged":true} % curl 192.168.56.20:9200/_cat/shards wiki1 0 p STARTED 3014 31.1mb 192.168.56.10 Stiletto wiki1 0 r INITIALIZING 0 14.3mb 192.168.56.30 Frankie Raye wiki1 1 p STARTED 3013 29.6mb 192.168.56.30 Frankie Raye wiki1 1 r INITIALIZING 0 13.1mb 192.168.56.20 Commander Kraken wiki1 2 r INITIALIZING 0 14mb 192.168.56.10 Stiletto wiki1 2 p STARTED 3973 38.1mb 192.168.56.20 Commander Kraken
If a shard cannot be assigned, for example you’ve overallocated the
number of replicas for the number of nodes in the cluster, the shard
will remain UNASSIGNED
with the reason code ALLOCATION_FAILED
.
% curl -XPUT 192.168.56.20:9200/_settings -d'{"number_of_replicas":3}' % curl 192.168.56.20:9200/_cat/health 1384316325 20:18:45 foo yellow 3 3 9 3 0 0 3 % curl 192.168.56.20:9200/_cat/shards wiki1 0 p STARTED 3014 31.1mb 192.168.56.10 Stiletto wiki1 0 r STARTED 3014 31.1mb 192.168.56.30 Frankie Raye wiki1 0 r STARTED 3014 31.1mb 192.168.56.20 Commander Kraken wiki1 0 r UNASSIGNED ALLOCATION_FAILED wiki1 1 r STARTED 3013 29.6mb 192.168.56.10 Stiletto wiki1 1 p STARTED 3013 29.6mb 192.168.56.30 Frankie Raye wiki1 1 r STARTED 3013 29.6mb 192.168.56.20 Commander Kraken wiki1 1 r UNASSIGNED ALLOCATION_FAILED wiki1 2 r STARTED 3973 38.1mb 192.168.56.10 Stiletto wiki1 2 r STARTED 3973 38.1mb 192.168.56.30 Frankie Raye wiki1 2 p STARTED 3973 38.1mb 192.168.56.20 Commander Kraken wiki1 2 r UNASSIGNED ALLOCATION_FAILED
Reasons for unassigned shard
editThese are the possible reasons for a shard be in a unassigned state:
|
Unassigned as a result of an API creation of an index. |
|
Unassigned as a result of a full cluster recovery. |
|
Unassigned as a result of opening a closed index. |
|
Unassigned as a result of importing a dangling index. |
|
Unassigned as a result of restoring into a new index. |
|
Unassigned as a result of restoring into a closed index. |
|
Unassigned as a result of explicit addition of a replica. |
|
Unassigned as a result of a failed allocation of the shard. |
|
Unassigned as a result of the node hosting it leaving the cluster. |
|
Unassigned as a result of explicit cancel reroute command. |
|
When a shard moves from started back to initializing, for example, with shadow replicas. |
|
A better replica location is identified and causes the existing replica allocation to be cancelled. |