Elasticsearch: Fix passing of limit and datalinks to logs data frame (#68554)

* Elasticsearch: Fix passing of limit and datalinks to logs data frame

* Update public/app/core/logsModel.ts

Co-authored-by: François Massot <francois.massot@gmail.com>

---------

Co-authored-by: François Massot <francois.massot@gmail.com>
This commit is contained in:
Ivana Huckova
2023-05-17 14:28:32 +02:00
committed by GitHub
parent d20a03e2d1
commit dbbbc46351
8 changed files with 81 additions and 22 deletions

View File

@@ -160,7 +160,7 @@ func processLogsResponse(res *es.SearchResponse, target *Query, configuredFields
frames := data.Frames{}
frame := data.NewFrame("", fields...)
setPreferredVisType(frame, data.VisTypeLogs)
setSearchWords(frame, searchWords)
setLogsCustomMeta(frame, searchWords, stringToIntWithDefaultValue(target.Metrics[0].Settings.Get("limit").MustString(), defaultSize))
frames = append(frames, frame)
queryRes.Frames = frames
@@ -1137,7 +1137,7 @@ func setPreferredVisType(frame *data.Frame, visType data.VisType) {
frame.Meta.PreferredVisualization = visType
}
func setSearchWords(frame *data.Frame, searchWords map[string]bool) {
func setLogsCustomMeta(frame *data.Frame, searchWords map[string]bool, limit int) {
i := 0
searchWordsList := make([]string, len(searchWords))
for searchWord := range searchWords {
@@ -1156,6 +1156,7 @@ func setSearchWords(frame *data.Frame, searchWords map[string]bool) {
frame.Meta.Custom = map[string]interface{}{
"searchWords": searchWordsList,
"limit": limit,
}
}