Complete the code to create an index named "library".
{
"[1]": "library"
}The key to create an index in Elasticsearch is "index" which specifies the index name.
Complete the code to set the number of shards to 3 in the index settings.
{
"settings": {
"number_of_shards": [1]
}
}The number of shards must be a number, so 3 without quotes is correct.
Fix the error in the mapping by completing the field type for "title".
{
"mappings": {
"properties": {
"title": {
"type": "[1]"
}
}
}
}"text" is the correct type for full-text searchable fields in Elasticsearch.
Fill both blanks to set the number of replicas to 2 and refresh interval to 1s.
{
"settings": {
"number_of_replicas": [1],
"refresh_interval": "[2]"
}
}Number of replicas is a number (2), and refresh interval is a string with time unit ("1s").
Fill all three blanks to create a mapping for a "date" field named "publish_date" with format "yyyy-MM-dd".
{
"mappings": {
"properties": {
"[1]": {
"type": "[2]",
"format": "[3]"
}
}
}
}The field name is "publish_date", type is "date", and the format is "yyyy-MM-dd" for year-month-day.