504 Gateway Time-out

I've run a query with terms facets.
The main query will return only 13 hits:

but I've added a terms facets.
"facets" : {
"allterms" : {
"terms" : {
"field" : "strItemKeywords",
"size" : 5
}
}
}

When I use curl to run, I got:

504 Gateway Time-out

504 Gateway Time-out


nginx/1.0.5

the field strItemKeywords contain a lot of terms for each hit, (about 500 to 1000), if I change tge terms field to another, (may only have just 1 term), the above exception will never happen..

like:
"facets" : {
"allterms" : {
"terms" : {
"field" : "dTItemDateTime",
"size" : 5
}
}
}
I will get :
"facets" : {
"allterms" : {
"_type" : "terms",
"missing" : 0,
"total" : 13,
"other" : 1,
"terms" : [ {
"term" : 1340262765000,
"count" : 2
}, {
"term" : 1340242261000,
"count" : 2
}, {
"term" : 1340279836000,
"count" : 1
}, {
"term" : 1340272114000,
"count" : 1
}, {
"term" : 1340270016000,
"count" : 1
}, {
"term" : 1340268728000,
"count" : 1
}, {
"term" : 1340261653000,
"count" : 1
}, {
"term" : 1340257709000,
"count" : 1
}, {
"term" : 1340243107000,
"count" : 1
}, {
"term" : 1340242851000,
"count" : 1
} ]
}
}
...

So any suggestions for this?

Just realize that strItemKeywords is not a single token, it is a big string separated with comma and spaces, so any idea if I want to get the top 10 terms for this field? Seemed that it's not possible to directly use terms facets.