0
0
Elasticsearchquery~10 mins

Numeric field 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 integer field in Elasticsearch mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "age": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Adate
Btext
Ckeyword
Dinteger
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'text' instead of a numeric type.
Using 'keyword' which is for exact string matches.
2fill in blank
medium

Complete the code to define a floating point number field in Elasticsearch mapping.

Elasticsearch
{
  "mappings": {
    "properties": {
      "price": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Afloat
Binteger
Ckeyword
Dboolean
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'integer' which only stores whole numbers.
Using 'boolean' which stores true/false values.
3fill in blank
hard

Fix the error in the mapping by choosing the correct numeric type for a large integer value.

Elasticsearch
{
  "mappings": {
    "properties": {
      "population": { "type": "[1]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ainteger
Blong
Cshort
Dbyte
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'integer' which has a smaller range.
Using 'byte' or 'short' which are for smaller numbers.
4fill in blank
hard

Fill both blanks to define a mapping with a double and a scaled_float field.

Elasticsearch
{
  "mappings": {
    "properties": {
      "rating": { "type": "[1]" },
      "price_scaled": { "type": "[2]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Adouble
Bscaled_float
Cfloat
Dinteger
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'integer' for decimal numbers.
Mixing up 'float' and 'scaled_float' types.
5fill in blank
hard

Fill all three blanks to define a mapping with byte, short, and integer numeric types.

Elasticsearch
{
  "mappings": {
    "properties": {
      "small_number": { "type": "[1]" },
      "medium_number": { "type": "[2]" },
      "large_number": { "type": "[3]" }
    }
  }
}
Drag options to blanks, or click blank then click option'
Abyte
Bshort
Cinteger
Dlong
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'long' for small numbers.
Mixing up the order of numeric types.