Kniffelig facet performance

Hi folks.

I am very wondering about facet performance.
I just added 10,000,000 docs and each doc has only two

When I queried as {"query":{"in":{"userId":["1000"]}}},
this was very fast and matched only 17 docs;

took: 3
timed_out: false
_shards: {
total: 5
successful: 5
failed: 0
hits: {
total: 17
max_score: 14.561651
hits: [
_index: music
_type: recomm
_id: FhFX708PTPK9bwmNsCWmXQ
_score: 14.561651
_source: {
userId: 1000
musicId: 16398

However when I queried again along with facet, this was so slow.

"size" : "0",

took: 129

In my opinion if facet is computed only on searched 17 docs(userId=1000),
this should be more fast than 129ms.

For more testing, I queried as "{
"facets":{"plays":{"terms":{"size":3,"field":"musicId"}}}}". If I
understand correctly, this query may access all docs. In practice, but,
there is no big difference with above facet.

took: 279

I think that this is not memory issue and not cache issue because all of
docs size is under 50mb.

What I am missing? Please give me some advice.
Thanks for reading.

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit