Elastic: Add id field to Elastic responses to allow permalinking (#73382)

* add `id` field to elasticsearch

* add comment

* slightly better perf

* only add `id` to logs frames

* only add `id` for logs responses

* concat `index` and `id`

* change snapshot generation to false

* use better loop

* fix tests

* moved up
This commit is contained in:
Sven Grossmann
2023-08-18 11:39:58 +02:00
committed by GitHub
parent 124e0efe1f
commit 4c9469fc9e
4 changed files with 45 additions and 17 deletions

View File

@@ -131,6 +131,12 @@ func processLogsResponse(res *es.SearchResponse, target *Query, configuredFields
}
}
// we are going to add an `id` field with the concatenation of `_id` and `_index`
_, ok := doc["id"]
if !ok {
doc["id"] = fmt.Sprintf("%v#%v", doc["_index"], doc["_id"])
}
for key := range doc {
propNames[key] = true
}