Elasticsearch: View in context feature for logs (#28764)

* Elasticsearch: View in context feature for logs

* Fixing unused type

* Limit show context to esVersion > 5

* Fixing scope for showContextToggle; removing console.log

* Fix typing; adding check for lineField

* Update test to reflect new sorting keys for logs

* Removing sort from metadata fields

* Adding comment for clarity

* Fixing scenerio where the data is missing

* remove export & use optional chaining

Co-authored-by: Elfo404 <gio.ricci@grafana.com>
This commit is contained in:
Chris Cowan
2020-12-10 04:19:14 -07:00
committed by GitHub
parent 8b21290164
commit 491a4dc967
5 changed files with 117 additions and 10 deletions

View File

@@ -372,6 +372,7 @@ export class ElasticResponse {
_id: hit._id,
_type: hit._type,
_index: hit._index,
sort: hit.sort,
};
if (hit._source) {
@@ -552,6 +553,7 @@ type Doc = {
_type: string;
_index: string;
_source?: any;
sort?: Array<string | number>;
};
/**
@@ -572,6 +574,7 @@ const flattenHits = (hits: Doc[]): { docs: Array<Record<string, any>>; propNames
_id: hit._id,
_type: hit._type,
_index: hit._index,
sort: hit.sort,
_source: { ...flattened },
...flattened,
};