0
0
Elasticsearchquery~10 mins

Index mappings overview in Elasticsearch - Interactive Code Practice

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

Complete the code to define a text field in an Elasticsearch mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "title": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Akeyword
Bdate
Cinteger
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'keyword' instead of 'text' for full-text search fields.
Using 'integer' or 'date' for string fields.
2fill in blank
medium

Complete the code to define a keyword field for exact matching.

Elasticsearch
{
  "mappings": {
    "properties": {
      "status": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aboolean
Btext
Ckeyword
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' when exact matching is needed.
Using numeric types for string fields.
3fill in blank
hard

Fix the error in the mapping by choosing the correct type for a date field.

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

Fill both blanks to define a nested object field with a keyword subfield.

Elasticsearch
{
  "mappings": {
    "properties": {
      "author": {
        "type": "[1]",
        "properties": {
          "name": { "type": "[2]" }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aobject
Btext
Ckeyword
Dnested
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nested' when 'object' is sufficient.
Using 'text' instead of 'keyword' for exact matches.
5fill in blank
hard

Fill all three blanks to define a mapping with a text field, a keyword subfield, and a date field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "description": {
        "type": "[1]",
        "fields": {
          "raw": { "type": "[2]" }
        }
      },
      "publish_date": { "type": "[3]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Atext
Bkeyword
Cdate
Dobject
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'keyword' as main type instead of 'text'.
Using 'text' for date fields.
Omitting the 'fields' keyword for subfields.