# Extract CPU user pct along with its time using Query DSL

**URL:** <https://discuss.elastic.co/t/extract-cpu-user-pct-along-with-its-time-using-query-dsl/247727>\
**Category:** Elasticsearch\
**Created:** [September 7, 2020, 8:09am UTC](https://discuss.elastic.co/t/extract-cpu-user-pct-along-with-its-time-using-query-dsl/247727 "2020-09-07T08:09:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiv97](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@shiv97](https://discuss.elastic.co/u/shiv97)\
**Post date:** [September 7, 2020, 8:09am UTC](https://discuss.elastic.co/t/extract-cpu-user-pct-along-with-its-time-using-query-dsl/247727/1 "2020-09-07T08:09:06Z")

</div>

Hi Every one  
I am having metricbeat data I need to extract system.cpu.user.pct along with time using query DSL.

I have checked and got how to extract the CPU user pct but now I want the time for each CPU user pct value too.

Kindly provide me help the query i used for getting cpu.user.pct is below:-

"query": {  
"bool": {  
"must": [  
{  
"range": {  
"system.cpu.user.pct": {  
"gte": 0.0  
}  
}  
},  
{  
"range": {  
"@timestamp": {  
"gte": "now-1h",  
"lte": "now"  
}  
}  
}  
]  
}  
}

---

<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:** [October 5, 2020, 8:09am UTC](https://discuss.elastic.co/t/extract-cpu-user-pct-along-with-its-time-using-query-dsl/247727/2 "2020-10-05T08:09:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
