Add a new field with a calculation on every document insertion

(Ravi Shanker Reddy) #1

My document looks like

{ "start_time" : "2016-Sep-04 18:06:24.352", "end_time" : "2016-Sep-04 18:06:28.352" }

When I inserted this document into the ES I want it to become as

{ "start_time" : "2016-Sep-04 18:06:24.352", "end_time" : "2016-Sep-04 18:06:28.352", "difference": 2000 }

The difference is in millisecond. Is there any way top acheive this. I seen scripting, updatebyquery & so on. But I dont get any idea. Please help me with this????

(Ravi Shanker Reddy) #2

Is there anyway for this?????

(Adrien Grand) #3

For now the only way to do it is on client side. In the next version of elasticsearch (5.0) we are adding capabilities in order to enrich the source, see

(system) #4