Elasticsearch: Add query building for log queries (#60182)

* Elasticsearch: Fix ordering in raw_document and add logic for raw_data

* Add comments

* Fix raw data request to use correct timefield

* Fix linting

* Add raw data as metric type

* Fix linting

* Elasticsearch: Add defaults for log query

* Add higlight

* Fix lint

* Add snapshot test

* Implement correct query for logs

* Update

* Adjust naming and comments

* Fix lint

* Remove ifs
This commit is contained in:
Ivana Huckova
2022-12-14 13:56:09 +01:00
committed by GitHub
parent 3188a8288e
commit d3ef86bd90
7 changed files with 185 additions and 37 deletions

View File

@ -92,6 +92,19 @@ func (b *SearchRequestBuilder) AddDocValueField(field string) *SearchRequestBuil
return b
}
// Add highlights to the search request for log queries
func (b *SearchRequestBuilder) AddHighlight() *SearchRequestBuilder {
b.customProps["highlight"] = map[string]interface{}{
"fields": map[string]interface{}{
"*": map[string]interface{}{},
},
"pre_tags": []string{"@HIGHLIGHT@"},
"post_tags": []string{"@/HIGHLIGHT@"},
"fragment_size": 2147483647,
}
return b
}
// Query creates and return a query builder
func (b *SearchRequestBuilder) Query() *QueryBuilder {
if b.queryBuilder == nil {