# How can i find doc.values when i use terms\_stats?

**URL:** <https://discuss.elastic.co/t/how-can-i-find-doc-values-when-i-use-terms-stats/15872>\
**Category:** Elasticsearch\
**Created:** [February 18, 2014, 9:58am UTC](https://discuss.elastic.co/t/how-can-i-find-doc-values-when-i-use-terms-stats/15872 "2014-02-18T09:58:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![happyprg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/happyprg/32/681_2.png) [@happyprg](https://discuss.elastic.co/u/happyprg)\
**Post date:** [February 18, 2014, 9:58am UTC](https://discuss.elastic.co/t/how-can-i-find-doc-values-when-i-use-terms-stats/15872/1 "2014-02-18T09:58:59Z")

</div>

request ...

{  
"query": {  
"field": {  
"userId": "2254"  
}  
},  
"facets": {  
"runningTimeStat": {  
"terms\_stats": {  
"key\_field": "uniquePlayId",  
"value\_field": "scrubberPosition"  
}  
}  
}  
}

result response ...  
facets: {  
runningTimeStat: {  
\_type: terms\_stats  
missing: 0  
terms: [  
{  
term:  
count: 90  
total\_count: 90  
min: 0  
max: 290  
total: 5474  
mean: 60.82222222222222  
}  
{  
term: b48f6180-9be4-498d-830a-6c324dd428e7  
count: 38  
total\_count: 38  
min: 0  
max: 219  
total: 5104  
mean: 134.31578947368422  
}  
{  
term: aa36a718-cf88-4f47-8ff3-ade231d784b9  
count: 19  
total\_count: 19  
min: 0  
max: 353  
total: 5047  
mean: 265.63157894736844  
}

my question-

doc is consist of various fields  
e.g) uniquePlayId,userId,trackId, ....

i need a docs field values userID or trackId or and More  
e.g )  
term : aa36a718-cf88-4f47-8ff3-ade231d784b9  
trackId :? //need this field value  
userId : ? //need this field value

how can i find trackId or userId values of term "aa36a718-cf88-4f47-8ff3-ade231d784b9"s?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:49am UTC](https://discuss.elastic.co/t/how-can-i-find-doc-values-when-i-use-terms-stats/15872/2 "2017-07-06T01:49:31Z")

</div>


