I am un able to get any result by using divide operator in Kibana 4.3


(Rizwan) #1

My divide operator is not working
I am doing this :

doc['total calls offered'].value/doc['total calls abandon'].value

However,
I am getting result by using add (+) operator

doc['total calls offered'].value+doc['total calls abandon'].value

Please guide.


(Court Ewing) #2

I'm not 100% on this, but I don't believe lucene query syntax supports arithmetic. I think the + operator is just an alias of AND.


(Rizwan) #3

but in Kibana, they have mentioned that we can use / operator . And + operator is adding my values not concatenating them.


(Court Ewing) #4

I may have misunderstood your issue: are you doing this in a scripted field?


(Rizwan) #5

yes i want to make a scripted field.


(Jim Unger) #6

I was able to index some records and create the specified scripted field (see below). How are the fields that you are trying to use mapped in your elasticsearch index?


(Rizwan) #7

I have tried as you showed in your example but I am getting errors while making visualizations.

Their data type is long PFB the mapping:

"Total Calls Abandon": {
"type": "long"
},
"Total Calls Offered": {
"type": "long"


(Rizwan) #8

and i am using this script in kibana

doc['Total Calls Abandon']/doc['Total Calls Offered'] this is giving me error.

and doc['Total Calls Abandon'].value/doc['Total Calls Offered'].value is giving me blank visualization.


(Jim Unger) #9

The only thing that I see was different between my example and yours was that you had spaces in the your field names. I Recreated it the best that I could with the information that I have and was still unable to replicate the issue. Here is my mapping:

{
  "funger2": {
    "mappings": {
      "calls": {
        "properties": {
          "@timestamp": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis"
          },
          "total calls abandon": {
            "type": "long"
          },
          "total calls offered": {
            "type": "long"
          }
        }
      }
    }
  }
}

I WAS able to get an error message to happen if I didn't type the fields name exactly including case when building my scripted field.

Can you please supply your mapping, and a sample of data so that I can recreate it better? Also, what exactly is the error message that you are receiving?


(Rizwan) #10

Jim thanks for ur reply. Below is the overall mapping and attached are the snapshots for reference.



{
"cc_stats": {
"mappings": {
"ccstats_report": {
"properties": {
"Call Date": {
"type": "date",
"format": "dateOptionalTime"
},
"Total Calls Abandon": {
"type": "long"
},
"Total Calls Answered": {
"type": "long"
},
"Total Calls Initiated": {
"type": "long"
},
"Total Calls Offered": {
"type": "long"
}
}
}
}
}
}


(Jim Unger) #11

@mrizwan were you able to get this to work? I have been away and apologize for my lapse in communication.


(system) #12