Hello,
I have an index where I store some server information I pull from an http API, I'm trying to get a pie chart with the number of vcpus each of the server has available. I have to multiply the 'totalProcessorCores' by 2 to get the vcpus (threads) but for some reason I'm getting either of this messages depending of the request I'm sending to elasticsearch.
Visualize: [parsing_exception] Unknown key for a START_OBJECT in [script]
{
"size": 0,
"query": {
"bool": {
"must": [
{
"query_string": {
"analyze_wildcard": true,
"query": "type: Server"
}
},
{
"range": {
"@timestamp": {
"gte": 1491195600000,
"lte": 1491281999999,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
},
"_source": {
"excludes": []
},
"aggs": {
"2": {
"terms": {
"field": "id.name",
"size": 20,
"order": {
"_term": "desc"
}
},
"aggs": {
"1": {
"top_hits": {
"docvalue_fields": [
"totalProcessorCores"
],
"_source": "totalProcessorCores",
"size": 1,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
],
"script": {
"lang": "groovy",
"inline": "doc['totalProcessorCores'].value * 2"
}
}
}
}
}
}
}
Visualize: [parsing_exception] Unknown key for a VALUE_STRING in [script]
{
.
.
.,
"script": "doc['totalProcessorCores'].value * 2",
"lang": "groovy"
}
}
}
}
}
}
I also allowed the groovy scripts in my elasticsearch.yml and restarted the service.
script.engine.groovy.inline.aggs: true
script.engine.groovy.inline.search: true
In some posts I found googling this errors they were always related to some typo or bad use of the DSL but I don't seem to catch mine. I already checked it agains the current docs and also tried this example with no success.
Thank you,
N