diff --git a/search/time_series.go b/search/time_series.go index d17fcc7a956d9a3d5a3d4776aaac9df376de3d59..c0eebc196bf2dfc90f29d12ef5cf375ef0715db2 100644 --- a/search/time_series.go +++ b/search/time_series.go @@ -220,10 +220,11 @@ func structMappingProperties(structType reflect.Type) (map[string]MappingPropert } } - //allow user to change that with a search tag on the field + // allow user to change that with a search tag on the field + skip := false switch structField.Tag.Get("search") { case "": - //no change + // no change case "keyword": fieldMapping.Type = "keyword" case "long": @@ -235,12 +236,18 @@ func structMappingProperties(structType reflect.Type) (map[string]MappingPropert case "object": fieldMapping.Type = "object" fieldMapping.Enabled = false + case "-": + // do not include in mapping + skip = true default: return nil, errors.Errorf("Unknown search:\"%s\" on field(%s)", structField.Tag.Get("search"), structField.Name) } - //add to index spec - properties[fieldName] = fieldMapping + // add to index spec + if !skip { + properties[fieldName] = fieldMapping + } + } return properties, nil }