December 2015
Intermediate to advanced
176 pages
3h 25m
English
While understanding the distribution of shards is essential, understanding the distribution of documents is also critical. Elasticsearch works to evenly spread the documents at shards. This is an appropriate behavior. Having a shard with the majority of the data cannot be wise.
Let's start two Elasticsearch nodes and create an index by running the following command:
curl -XPUT localhost:9200/my_index -d '{
settings: {
number_of_shards: 2,
number_of_replicas: 0
}
}'
{"acknowledged":true}We've created an index without replicas that are built of two shards. Now we add a document to index:
curl -XPOST localhost:9200/my_index/document -d '{ "title": "The first document" }' {"_index":"my_index","_type":"document","_id":"AU_iaqgDlNVjy8IaI4FM","_version":1,"created":true} ...Read now
Unlock full access