Getting document ids in facets query

Hi
Is it possible to return also document ids inside a facet query ? Example :

{
"from": 0,
"size": 0,
"explain": false,
"min_score": 0.01,
"facets": {

   "ownsOrdered": {
        "terms": {
            "field": "owns",
             "size" : 1,
            "order": "reverse_term"
        }
    }
},
    
"query": {
   // bla bla query
},
"fields": [
    "id"
   
]

}

The result of that query is :

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 11894,
"max_score": 1,
"hits": []
},
"facets": {
"ownsOrdered": {
"_type": "terms",
"missing": 0,
"total": 11894,
"other": 11892,
"terms": [
{
"term": 4,
"count": 2
}
]
}
}
}

Is there any way to attach to the "ownsOrdered" facet the document ids
matching the facet ?
Of course i could do another query that orders the documents upon the
relevant facet , but i just dont want to make 2 queries.

--

found it : terms_stats does exactly that

On Sunday, January 6, 2013 2:48:40 PM UTC+2, Roman Kournjaev wrote:

Hi
Is it possible to return also document ids inside a facet query ? Example
:

{
"from": 0,
"size": 0,
"explain": false,
"min_score": 0.01,
"facets": {

   "ownsOrdered": {
        "terms": {
            "field": "owns",
             "size" : 1,
            "order": "reverse_term"
        }
    }
},
    
"query": {
   // bla bla query
},
"fields": [
    "id"
   
]

}

The result of that query is :

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 11894,
"max_score": 1,
"hits": []
},
"facets": {
"ownsOrdered": {
"_type": "terms",
"missing": 0,
"total": 11894,
"other": 11892,
"terms": [
{
"term": 4,
"count": 2
}
]
}
}
}

Is there any way to attach to the "ownsOrdered" facet the document ids
matching the facet ?
Of course i could do another query that orders the documents upon the
relevant facet , but i just dont want to make 2 queries.

--