0
0
Elasticsearchquery~10 mins

Why mappings define document structure in Elasticsearch - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a mapping with a text field named 'title'.

Elasticsearch
{
  "mappings": {
    "properties": {
      "title": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Adate
Btext
Ckeyword
Dinteger
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'keyword' instead of 'text' for searchable text fields.
2fill in blank
medium

Complete the code to define a mapping with a date field named 'publish_date'.

Elasticsearch
{
  "mappings": {
    "properties": {
      "publish_date": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Adate
Btext
Cinteger
Dboolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' type for date fields.
3fill in blank
hard

Fix the error in the mapping by choosing the correct type for the 'price' field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "price": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Atext
Bdate
Ckeyword
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' or 'keyword' for numeric fields.
4fill in blank
hard

Fill both blanks to define a mapping with a nested object field named 'author' having a 'name' text field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "author": {
        "type": "[1]",
        "properties": {
          "name": { "type": "[2]" }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Anested
Bobject
Ctext
Dkeyword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' instead of 'nested' when nested queries are needed.
5fill in blank
hard

Fill all three blanks to define a mapping with a 'tags' field as keyword array and a 'views' integer field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "tags": { "type": "[1]" },
      "views": { "type": "[2]" },
      "active": { "type": "[3]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Akeyword
Binteger
Cboolean
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' for tags or wrong types for views and active.