Skip to content

Commit

Permalink
Invert global boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Stucki committed Nov 10, 2020
1 parent df8f31e commit 3d0384e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions libbeat/template/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (

// Processor struct to process fields to template
type Processor struct {
EsVersion common.Version
Migration bool
OSS bool
EsVersion common.Version
Migration bool
ElasticLicensed bool
}

var (
Expand Down Expand Up @@ -76,7 +76,7 @@ func (p *Processor) Process(fields mapping.Fields, state *fieldState, output com
indexMapping = p.text(&field)
case "wildcard":
noWildcards := p.EsVersion.LessThan(common.MustNewVersion("7.9.0"))
if p.OSS || noWildcards {
if !p.ElasticLicensed || noWildcards {
indexMapping = p.keyword(&field)
} else {
indexMapping = p.wildcard(&field)
Expand Down
6 changes: 3 additions & 3 deletions libbeat/template/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ func TestProcessWildcardOSS(t *testing.T) {
t.Fatal(err)
}

p := Processor{EsVersion: *version, OSS: true}
p := Processor{EsVersion: *version}
err = p.Process(fields, nil, output)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -740,7 +740,7 @@ func TestProcessWildcardElastic(t *testing.T) {
t.Fatal(err)
}

p := Processor{EsVersion: *version, OSS: false}
p := Processor{EsVersion: *version, ElasticLicensed: true}
err = p.Process(fields, nil, output)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -782,7 +782,7 @@ func TestProcessWildcardPreSupport(t *testing.T) {
t.Fatal(err)
}

p := Processor{EsVersion: *version, OSS: false}
p := Processor{EsVersion: *version, ElasticLicensed: true}
err = p.Process(fields, nil, output)
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion libbeat/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (t *Template) load(fields mapping.Fields) (common.MapStr, error) {

// Start processing at the root
properties := common.MapStr{}
processor := Processor{EsVersion: t.esVersion, OSS: version.OSS, Migration: t.migration}
processor := Processor{EsVersion: t.esVersion, ElasticLicensed: version.ElasticLicensed, Migration: t.migration}
if err := processor.Process(fields, nil, properties); err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions libbeat/version/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ var (
commit = "unknown"
qualifier = ""

// OSS provides if this is the OSS distro
OSS = true
// ElasticLicensed provides if this is an Elastic Licensed distro or OSS
ElasticLicensed = false
)

// BuildTime exposes the compile-time build time information.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/libbeat/cmd/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

func init() {
version.OSS = false
version.ElasticLicensed = true
}

// AddXPack extends the given root folder with XPack features
Expand Down

0 comments on commit 3d0384e

Please sign in to comment.