mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Create Raw Doc metric to render raw JSON docs in columns in the new table panel (#26233)
* test * WIP: Create v2 version * Update tests, remove conosole logs, refactor * Remove incorrect types * Update type * Rename legacy and new metrics * Update * Run request when Raw Data tto Raw Document switch * Fix size updating * Remove _source field from table results as we are showing each source field as column * Remove _source just for metrics, not logs * Revert "Remove _source just for metrics, not logs" This reverts commit611b6922f7. * Revert "Remove _source field from table results as we are showing each source field as column" This reverts commit31a9d5f81b. * Add vis preference for logs * Update visualisation to logs * Revert "Revert "Remove _source just for metrics"" This reverts commita102ab2894. Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
@@ -212,7 +212,8 @@ export class ElasticQueryBuilder {
|
||||
// If target doesn't have bucketAggs and type is not raw_document, it is invalid query.
|
||||
if (target.bucketAggs.length === 0) {
|
||||
metric = target.metrics[0];
|
||||
if (!metric || metric.type !== 'raw_document') {
|
||||
|
||||
if (!metric || !(metric.type === 'raw_document' || metric.type === 'raw_data')) {
|
||||
throw { message: 'Invalid query' };
|
||||
}
|
||||
}
|
||||
@@ -221,7 +222,7 @@ export class ElasticQueryBuilder {
|
||||
* Check if metric type is raw_document. If metric doesn't have size (or size is 0), update size to 500.
|
||||
* Otherwise it will not be a valid query and error will be thrown.
|
||||
*/
|
||||
if (target.metrics?.[0]?.type === 'raw_document') {
|
||||
if (target.metrics?.[0]?.type === 'raw_document' || target.metrics?.[0]?.type === 'raw_data') {
|
||||
metric = target.metrics[0];
|
||||
const size = (metric.settings && metric.settings.size !== 0 && metric.settings.size) || 500;
|
||||
return this.documentQuery(query, size);
|
||||
|
||||
Reference in New Issue
Block a user