WARNING: Version 6.1 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Convert Processor
editConvert Processor
editConverts an existing field’s value to a different type, such as converting a string to an integer. If the field value is an array, all members will be converted.
The supported types include: integer
, float
, string
, boolean
, and auto
.
Specifying boolean
will set the field to true if its string value is equal to true
(ignore case), to
false if its string value is equal to false
(ignore case), or it will throw an exception otherwise.
Specifying auto
will attempt to convert the string-valued field
into the closest non-string type.
For example, a field whose value is "true"
will be converted to its respective boolean type: true
. And
a value of "242.15"
will "automatically" be converted to 242.15
of type float
. If a provided field cannot
be appropriately converted, the Convert Processor will still process successfully and leave the field value as-is. In
such a case, target_field
will still be updated with the unconverted field value.
Table 16. Convert Options
Name | Required | Default | Description |
---|---|---|---|
|
yes |
- |
The field whose value is to be converted |
|
no |
|
The field to assign the converted value to, by default |
|
yes |
- |
The type to convert the existing value to |
|
no |
|
If |
{ "convert": { "field" : "foo", "type": "integer" } }