Numeric datatypes

edit

The following numeric types are supported:

long

A signed 64-bit integer with a minimum value of -263 and a maximum value of 263-1.

integer

A signed 32-bit integer with a minimum value of -231 and a maximum value of 231-1.

short

A signed 16-bit integer with a minimum value of -32,768 and a maximum value of 32,767.

byte

A signed 8-bit integer with a minimum value of -128 and a maximum value of 127.

double

A double-precision 64-bit IEEE 754 floating point.

float

A single-precision 32-bit IEEE 754 floating point.

Below is an example of configuring a mapping with numeric fields:

PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "number_of_bytes": {
          "type": "integer"
        },
        "time_in_seconds": {
          "type": "float"
        }
      }
    }
  }
}

Parameters for numeric fields

edit

The following parameters are accepted by numeric types:

coerce

Try to convert strings to numbers and truncate fractions for integers. Accepts true (default) and false.

boost

Field-level index time boosting. Accepts a floating point number, defaults to 1.0.

doc_values

Should the field be stored on disk in a column-stride fashion, so that it can later be used for sorting, aggregations, or scripting? Accepts true (default) or false.

ignore_malformed

If true, malformed numbers are ignored. If false (default), malformed numbers throw an exception and reject the whole document.

include_in_all

Whether or not the field value should be included in the _all field? Accepts true or false. Defaults to false if index is set to no, or if a parent object field sets include_in_all to false. Otherwise defaults to true.

index

Should the field be searchable? Accepts not_analyzed (default) and no.

null_value

Accepts a numeric value of the same type as the field which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.

precision_step

Controls the number of extra terms that are indexed to make range queries faster. The default depends on the numeric type.

store

Whether the field value should be stored and retrievable separately from the _source field. Accepts true or false (default).