Average on string values containing % in elasticsearch


(bagui) #1

Hi,

I have a field of type string in documents and there are values like
"CPU_USED": "0.02%". I want to do average of all the values using some
filters. I tried with below but getting error. Please suggest how to do
this.

POST /virtualmachines/_search
{
"query" : {
"filtered" : {
"query" : { "match" : {
"CLOUD_TYPE" : "CLOUDSTACK"
}},
"filter" : {
"range" : { "NODE_CREATE_TIME" : { "from" : "2014-05-22
14:11:35", "to" : "2014-05-22 14:33:35" }}
}
}
},
"aggs" : {
"avg_cpu" : { "avg" : { "script" : "doc['CPU_USED'].value" } }
}
}

error :
AggregationExecutionException[Unsupported script value [0.03%]]

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/02462a04-aedb-4049-b650-9def0de582cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(bagui) #2

any suggestion ?

Subhadip

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/71bcd469-d1b7-4b37-87fd-b7100cb9e5ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(bagui) #3

Any help on this ?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cc52b02a-f71f-4bfa-9219-5f5a3a6b25b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Mark Walkom) #4

Patience, it has been the weekend after all :slight_smile:

Regards,
Mark Walkom

Infrastructure Engineer
Campaign Monitor
email: markw@campaignmonitor.com
web: www.campaignmonitor.com

On 26 May 2014 16:55, Subhadip Bagui i.bagui@gmail.com wrote:

Any help on this ?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/cc52b02a-f71f-4bfa-9219-5f5a3a6b25b2%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/cc52b02a-f71f-4bfa-9219-5f5a3a6b25b2%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEM624Y3WkfBeLN2jFSj8t6M_vi6ddgTWoU1%3Dt2wfNf%2BhmA%2Bxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #5