【发布时间】:2021-05-18 15:01:55
【问题描述】:
我正在尝试创建一个可以从 Elasticsearch 中提取特定指标的请求,这样我就可以更快地管理数据。 我通过以下请求摆脱了元数据和不必要的数据:
get localhost:9200/metricbeat-7.12.0/_search?size=2000&pretty&filter_path=hits.hits._source
{
"_source": ["@timestamp", "labels","prometheus"]
}
我得到了更接近我想要的东西。现在我想要一个额外的过滤器,我只得到指标“prometheus.metrics.windows_cpu_time_total”而不是其他指标。
{
"hits": {
"hits": [
{
{
"_source": {
"@timestamp": "2021-04-29T15:35:57.518Z",
"prometheus": {
"metrics": {
"windows_service_status": 0
},
"labels": {
"instance": "localhost:9182",
"name": "timebrokersvc",
"job": "prometheus",
"status": "lost comm"
}
}
}
},
{
"_source": {
"@timestamp": "2021-04-29T15:35:57.518Z",
"prometheus": {
"metrics": {
"windows_cpu_time_total": 29480.625
},
"labels": {
"mode": "idle",
"core": "0,0",
"instance": "localhost:9182",
"job": "prometheus"
}
}
}
}}]}}
我尝试了一个字段搜索,但似乎效果不佳。有人可以指出我的查询出了什么问题吗?
{
"query": {
"match_all": {}
},
"fields": [
"prometheus.metrics",
{
"field": "windows_cpu_time_total"
}]
}
提前谢谢你
【问题讨论】:
标签: elasticsearch elasticsearch-aggregation