Can some help in value count aggregations

Hi,
i am using value count aggragtion and with the script, pfb the script

"script": {
"lang": "painless",
"source": "for(int i=0; i<1; i++){if(doc['message.code'].size() >0 && doc['message.code'].value >= 300){doc['message.code'].value}}"
}
it is showing error as invalid argument exception. if i remove the for loop it is giving result but it will not give the expected result.

can some please help on this

Hi @anjilinga,

Can you explain what you are trying to achieve with the for loop. As far as I can see, the i variable from the loop is not used anywhere and that loop is only looping once through the inner code, so I would expect the same output with and without the loop.

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