Skip to content

Commit

Permalink
Issue #22: enable sort on _doc
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Nov 23, 2023
1 parent e2264b8 commit 54efaaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/quickwit/data_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ func processLogsQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defa
sort = es.SortOrderAsc
}
b.Sort(sort, defaultTimeField, "boolean")
// FIXME: check if sort by _doc is needed.
// b.Sort(sort, "_doc", "")
b.Sort(sort, "_doc", "")
b.Size(stringToIntWithDefaultValue(metric.Settings.Get("limit").MustString(), defaultSize))
// TODO when hightlight is supported in quickwit
// b.AddHighlight()
Expand All @@ -352,7 +351,7 @@ func processLogsQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defa
func processDocumentQuery(q *Query, b *es.SearchRequestBuilder, from, to int64, defaultTimeField string) {
metric := q.Metrics[0]
b.Sort(es.SortOrderDesc, defaultTimeField, "boolean")
// b.Sort(es.SortOrderDesc, "_doc", "")
b.Sort(es.SortOrderDesc, "_doc", "")
// Note: not supported in Quickwit
// b.AddDocValueField(defaultTimeField)
b.Size(stringToIntWithDefaultValue(metric.Settings.Get("size").MustString(), defaultSize))
Expand Down
1 change: 1 addition & 0 deletions pkg/quickwit/response_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func processLogsResponse(res *es.SearchResponse, target *Query, configuredFields

doc := map[string]interface{}{
"_source": flattened,
"sort": hit["sort"],
}

for k, v := range flattened {
Expand Down

0 comments on commit 54efaaf

Please sign in to comment.