Skip to content

Commit

Permalink
Issue #4: use output_format instead input format and make it optional
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Dec 18, 2023
1 parent 022d331 commit 6780309
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/quickwit/quickwit.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ type QuickwitMapping struct {
DocMapping struct {
TimestampField string `json:"timestamp_field"`
FieldMappings []struct {
Name string `json:"name"`
InputFormats []string `json:"input_formats"`
Name string `json:"name"`
Type string `json:"type"`
OutputFormat *string `json:"output_format,omitempty"`
} `json:"field_mappings"`
} `json:"doc_mapping"`
} `json:"index_config"`
Expand Down Expand Up @@ -92,8 +93,8 @@ func getTimestampFieldInfos(index string, qwUrl string, cli *http.Client) (strin
timestampFieldName := payload.IndexConfig.DocMapping.TimestampField
timestampFieldFormat := "undef"
for _, field := range payload.IndexConfig.DocMapping.FieldMappings {
if field.Name == timestampFieldName && len(field.InputFormats) > 0 {
timestampFieldFormat = field.InputFormats[0]
if field.Type == "datetime" && field.Name == timestampFieldName && nil != field.OutputFormat {
timestampFieldFormat = *field.OutputFormat
break
}
}
Expand Down

0 comments on commit 6780309

Please sign in to comment.