-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce elasticsearch.ingest_pipeline.name
as config option
#564
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,10 @@ import ( | |
|
||
const ( | ||
DirIngestPipeline = "ingest-pipeline" | ||
|
||
DefaultPipelineName = "default" | ||
DefaultPipelineNameJSON = "default.json" | ||
DefaultPipelineNameYAML = "default.yaml" | ||
) | ||
|
||
var validTypes = map[string]string{ | ||
|
@@ -34,8 +38,10 @@ type Dataset struct { | |
Type string `config:"type" json:"type" validate:"required"` | ||
Name string `config:"name" json:"name,omitempty" yaml:"name,omitempty"` | ||
|
||
Title string `config:"title" json:"title" validate:"required"` | ||
Release string `config:"release" json:"release"` | ||
Title string `config:"title" json:"title" validate:"required"` | ||
Release string `config:"release" json:"release"` | ||
|
||
// Deprecated: Replaced by elasticsearch.ingest_pipeline.name | ||
IngestPipeline string `config:"ingest_pipeline,omitempty" config:"ingest_pipeline" json:"ingest_pipeline,omitempty" yaml:"ingest_pipeline,omitempty"` | ||
ruflin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Streams []Stream `config:"streams" json:"streams,omitempty" yaml:"streams,omitempty" ` | ||
Package string `json:"package,omitempty" yaml:"package,omitempty"` | ||
|
@@ -81,6 +87,7 @@ type Variable struct { | |
type Elasticsearch struct { | ||
IndexTemplateSettings map[string]interface{} `config:"index_template.settings" json:"index_template.settings,omitempty" yaml:"index_template.settings,omitempty"` | ||
IndexTemplateMappings map[string]interface{} `config:"index_template.mappings" json:"index_template.mappings,omitempty" yaml:"index_template.mappings,omitempty"` | ||
IngestPipelineName string `config:"ingest_pipeline.name,omitempty" json:"ingest_pipeline.name,omitempty" yaml:"ingest_pipeline.name,omitempty"` | ||
} | ||
|
||
type fieldEntry struct { | ||
|
@@ -157,11 +164,22 @@ func (d *Dataset) Validate() error { | |
return fmt.Errorf("type is not valid: %s", d.Type) | ||
} | ||
|
||
if d.IngestPipeline == "" { | ||
if d.Elasticsearch != nil && d.Elasticsearch.IngestPipelineName == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is duplication of code inside this
Then calling it here as using it's return value in the condition of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As the code goes away very soon, I kept it "delete friendly". Do you think it is still worth cleaning up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I was not aware it was going away soon when I made the clean up comment. Okay to leave it as-is. |
||
// Check that no ingest pipeline exists in the directory except default | ||
for _, path := range paths { | ||
if filepath.Base(path) == DefaultPipelineNameJSON || filepath.Base(path) == DefaultPipelineNameYAML { | ||
d.Elasticsearch.IngestPipelineName = DefaultPipelineName | ||
// TODO: remove because of legacy | ||
d.IngestPipeline = DefaultPipelineName | ||
break | ||
} | ||
} | ||
// TODO: Remove, only here for legacy | ||
} else if d.IngestPipeline == "" { | ||
// Check that no ingest pipeline exists in the directory except default | ||
for _, path := range paths { | ||
if filepath.Base(path) == "default.json" || filepath.Base(path) == "default.yml" { | ||
d.IngestPipeline = "default" | ||
if filepath.Base(path) == DefaultPipelineNameJSON || filepath.Base(path) == DefaultPipelineNameYAML { | ||
d.IngestPipeline = DefaultPipelineName | ||
break | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a note to the Deprecated section of the changelog about deprecating
ingest_pipeline
in favor ofelasticsearch.ingest_pipeline
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this (my previous comment) is also not needed as the old way is going away very soon?