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 [email protected].
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.

Reply via email to