mirror of https://github.com/grafana/grafana
Elasticsearch: Add query building for log queries (#60182)
* Elasticsearch: Fix ordering in raw_document and add logic for raw_data * Add comments * Fix raw data request to use correct timefield * Fix linting * Add raw data as metric type * Fix linting * Elasticsearch: Add defaults for log query * Add higlight * Fix lint * Add snapshot test * Implement correct query for logs * Update * Adjust naming and comments * Fix lint * Remove ifspull/60238/head
parent
3188a8288e
commit
d3ef86bd90
@ -0,0 +1,23 @@ |
|||||||
|
[ |
||||||
|
{ |
||||||
|
"metrics": [ |
||||||
|
{ |
||||||
|
"id": "1", |
||||||
|
"type": "logs" |
||||||
|
} |
||||||
|
], |
||||||
|
"query": "", |
||||||
|
"refId": "A", |
||||||
|
"datasource": { |
||||||
|
"type": "elasticsearch", |
||||||
|
"uid": "PE50363A9B6833EE7" |
||||||
|
}, |
||||||
|
"alias": "", |
||||||
|
"bucketAggs": [], |
||||||
|
"timeField": "testtime", |
||||||
|
"key": "Q-ee8fea91-a4c4-4ded-9827-b362476a4083-0", |
||||||
|
"datasourceId": 39, |
||||||
|
"intervalMs": 2000, |
||||||
|
"maxDataPoints": 1318 |
||||||
|
} |
||||||
|
] |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
{ |
||||||
|
"docvalue_fields": [ |
||||||
|
"testtime" |
||||||
|
], |
||||||
|
"query": { |
||||||
|
"bool": { |
||||||
|
"filter": { |
||||||
|
"range": { |
||||||
|
"testtime": { |
||||||
|
"format": "epoch_millis", |
||||||
|
"gte": 1668422437218, |
||||||
|
"lte": 1668422625668 |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"script_fields": {}, |
||||||
|
"size": 500, |
||||||
|
"sort": |
||||||
|
{ |
||||||
|
"testtime": { |
||||||
|
"order": "desc", |
||||||
|
"unmapped_type": "boolean" |
||||||
|
}, |
||||||
|
"_doc": { |
||||||
|
"order": "desc" |
||||||
|
} |
||||||
|
}, |
||||||
|
"aggs": |
||||||
|
{ |
||||||
|
"1": { |
||||||
|
"date_histogram": { |
||||||
|
"field": "testtime", |
||||||
|
"fixed_interval": "1000ms", |
||||||
|
"format": "epoch_millis", |
||||||
|
"min_doc_count": 0, |
||||||
|
"extended_bounds": { |
||||||
|
"min": 1668422437218, |
||||||
|
"max": 1668422625668 |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
"highlight": |
||||||
|
{ |
||||||
|
"pre_tags": [ |
||||||
|
"@HIGHLIGHT@" |
||||||
|
], |
||||||
|
"post_tags": [ |
||||||
|
"@/HIGHLIGHT@" |
||||||
|
], |
||||||
|
"fragment_size": 2147483647, |
||||||
|
"fields": { |
||||||
|
"*": {} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue