0

Given the following Foo entry which is stored in an ElasticSearch index :

"Foo": {
  "x":"500",
  "y":"200"
}

What is the correct syntax to create a sripted field within Kibana which adds the X and Y values together?

user1052610
  • 4,440
  • 13
  • 50
  • 101

1 Answers1

3

If you index a document as follows

PUT scripted/doc/1
{
  "Foo": {
    "x":500,
    "y":200
  }
}

Then the syntax to sum the fields up in a scripted field is:

doc['Foo.x'].value + doc['Foo.y'].value

The x and y fields must be numeric fields. If you index them as strings you will get an error when trying to evaluate the scripted field.

Jakub Kotowski
  • 7,411
  • 29
  • 38