0
0
Elasticsearchquery~10 mins

Object and nested types 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 an object type field named 'user' in the mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "user": {
        "type": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aobject
Bnested
Ckeyword
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nested' instead of 'object' when no nested querying is needed.
2fill in blank
medium

Complete the code to define a nested type field named 'comments' in the mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "comments": {
        "type": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aobject
Bnested
Ctext
Dkeyword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' type when nested querying is required.
3fill in blank
hard

Fix the error in the mapping by completing the type for the 'address' field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "address": {
        "type": "[1]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aobject
Btext
Cnested
Dkeyword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' or 'keyword' for a complex object field.
4fill in blank
hard

Fill both blanks to define a nested field 'orders' with a subfield 'date' of type 'date'.

Elasticsearch
{
  "mappings": {
    "properties": {
      "orders": {
        "type": "[1]",
        "properties": {
          "date": {
            "type": "[2]"
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Anested
Bobject
Cdate
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'object' instead of 'nested' for 'orders'.
Using 'text' instead of 'date' for the 'date' field.
5fill in blank
hard

Fill all three blanks to define an object field 'profile' with a nested field 'activities' having a 'type' subfield of keyword type.

Elasticsearch
{
  "mappings": {
    "properties": {
      "profile": {
        "type": "[1]",
        "properties": {
          "activities": {
            "type": "[2]",
            "properties": {
              "type": {
                "type": "[3]"
              }
            }
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aobject
Bnested
Ckeyword
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nested' for 'profile' instead of 'object'.
Using 'text' instead of 'keyword' for the 'type' subfield.