Elasticsearch: Fix processing of logs with not-recognized time format (#67767)

* Elasticsearch: Fix parsing of invalid time

* Fix lint

* Add more test data to data.js

* Add tests

* Fix lint

* Update pkg/tsdb/elasticsearch/client/search_request.go
This commit is contained in:
Ivana Huckova
2023-05-04 19:33:00 +02:00
committed by GitHub
parent 49ff85ef54
commit 95cf598423
8 changed files with 142 additions and 37 deletions
@@ -99,6 +99,12 @@ func (b *SearchRequestBuilder) Sort(order SortOrder, field string, unmappedType
return b
}
// AddTimeFieldWithStandardizedFormat adds a time field to fields with standardized time format
func (b *SearchRequestBuilder) AddTimeFieldWithStandardizedFormat(timeField string) *SearchRequestBuilder {
b.customProps["fields"] = []map[string]string{{"field": timeField, "format": "strict_date_optional_time_nanos"}}
return b
}
// AddDocValueField adds a doc value field to the search request
func (b *SearchRequestBuilder) AddDocValueField(field string) *SearchRequestBuilder {
b.customProps["docvalue_fields"] = []string{field}