{
"query": {
"bool": {
"must": [
{
"term": {
"rtype.keyword": "820100"
}
},
{
"script": {
"script": {
"lang": "painless",
"source": "doc['url.keyword'].size()>0"
}
}
}
]
}
},
"size": 0,
"aggs": {
"account": {
"terms": {
"script": "doc['url.keyword'].value",
"size": 100000
}
},
"name": {
"terms": {
"script": "doc['url.keyword'].value",
"size": 100000
}
}
}
}
String urlAgg = "url";
Script exist = new Script("doc[