Given the following Elasticsearch request to create an index named library with a simple mapping, what will be the response status?
{
"mappings": {
"properties": {
"title": { "type": "text" },
"author": { "type": "keyword" },
"year": { "type": "integer" }
}
}
}Successful index creation returns acknowledged: true.
When an index is created successfully, Elasticsearch returns a JSON with acknowledged and shards_acknowledged set to true, and the index name.
When creating an Elasticsearch index, which setting defines how many primary shards the index will have?
Think about how data is split across the cluster.
The number_of_shards setting controls how many primary shards an index has. This determines how the data is divided.
Select the correct JSON body to create an Elasticsearch index named products with 1 primary shard and 3 replicas.
Settings keys must be exact and values numeric, not strings.
The correct keys are number_of_shards and number_of_replicas. Values should be numbers, not strings. Option A matches this exactly.
Consider this request to create an index named users with a mapping:
{
"mappings": {
"properties": {
"name": { "type": "text" },
"age": { "type": "integer" },
"email": { "type": "keyword" }
}
},
"settings": {
"number_of_shards": 0
}
}Why will this request fail?
Think about shard count limits.
Elasticsearch requires at least one primary shard. Setting number_of_shards to zero is invalid and causes the request to fail.
You want to optimize an Elasticsearch index for search speed and reduce storage size. Which setting disables storing the original JSON document and can improve performance?
The original JSON document is stored in a special field called _source.
Disabling _source storage with "_source": { "enabled": false } stops Elasticsearch from storing the original JSON, reducing storage and improving search speed, but you lose the ability to retrieve the original document.