Simple Problem with a duration script

I have this two fields, Hora_Fechamento (aka Closing_Time) and Hora_Abertura (aka Openning_Time) in a same line of data. What i wish is to get and visualize the time between in seconds or milli.

Tryied this script: emit(doc['Hora_Fechamento'].value - doc['Hora_Resposta'].value).millis
But it has multiple problems.

Note: It is my first time with painless, so the question might be a little dumb.

Try:

PUT /my-index/_mapping
{
  "runtime": {
    "Diferencia_de_Tiempo": {
      "type": "long",
      "script": {
        "source": "emit(doc['Hora_Fechamento'].value.millis - doc['Hora_Abertura'].value.millis)"
      }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.