I need to calculate diffrence of the same field with diffrent date but it's not working (elasticsearch , kibana)

well i have the same field in 2 indexes ,
i managed to join them in 1 index ,
but the problem is that i need to calculate the diffrence between activation date in day1 and activation date in day2 (day2 - day 1 shows number of subscribers , but i can't manage to get it )
i tried this but it's not working
help
{
"query": {
"function_score": {
"query": {
"match": { "message": "elasticsearch" }
},
"script_score" : {
"script" : {
"source": "Math.subtract((day1['Activation Date'].value) , day-2020-01-03['Activation Date'].value)"
}
}
}
}
}


{
"query": {
"function_score": {
"query": {
"match": { "message": "elasticsearch" }
},
"script_score" : {
"script" : {
"params": {
"b": "day1['Activation Date'].value",
"a": "day-2020-01-03['Activation Date'].value"
},
"source": "params.a - params.b"
}
}
}
}
}


{
"query" : {
"match_all": {}
},
"script_fields" : {
"test1" : {
"script" : {
"source": "(day-2020-01-03['Activation Date'].value) - (day1['Activation Date'].value)"
}
}
}
}


{
"query": {
"bool" : {
"must_not" : {
"range" : {
"Activation Date" : { day-2020-01-03['Activation Date'].value, day1['Activation Date'].value }
}
}

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