High CPU usage in facet query

Hi,

I am running a facet query and I have 2m docs indexed, when I am doing load testing (15 queries per second) then cpu usage is 400% and response time also increases.

Setup
4 nodes on a single machine with 1gb ram assigned to each node.

Here is the query that I am firing

{
"size": 0,
"query": {
"range": {
"TOTAL_SCORE": {
"gte": 0
}
}
},
"facets": {
"f": {
"terms": {
"field": "TOTAL_SCORE",
"size": 10000
}
}
}
}

Can any one suggest what's going wrong over here.

I'd suggest moving to or trying aggs, they are a lot more efficient.

Thanks Warkolm,

But I have tried that also but I have not find any significant performance gain, cpu still shoots out.

Maybe try with a single node at 4GB ram then, 1Gb isn't much heap for ES to work with.