Skip to content
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

Add IndexTemplate field under elasticsearch field #1069

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions internal/packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ type DataStreamManifest struct {
Hidden bool `config:"hidden" json:"hidden" yaml:"hidden"`
Release string `config:"release" json:"release" yaml:"release"`
Elasticsearch *struct {
IngestPipeline *struct {
Name string `config:"name" json:"name" yaml:"name"`
} `config:"ingest_pipeline" json:"ingest_pipeline" yaml:"ingest_pipeline"`
IndexTemplate *struct {
IngestPipeline *struct {
Name string `config:"name" json:"name" yaml:"name"`
} `config:"ingest_pipeline" json:"ingest_pipeline" yaml:"ingest_pipeline"`
} `config:"index_template" json:"index_template" yaml:"index_template"`
} `config:"elasticsearch" json:"elasticsearch" yaml:"elasticsearch"`
Streams []struct {
Input string `config:"input" json:"input" yaml:"input"`
Expand Down Expand Up @@ -255,8 +257,8 @@ func ReadDataStreamManifest(path string) (*DataStreamManifest, error) {
// GetPipelineNameOrDefault returns the name of the data stream's pipeline, if one is explicitly defined in the
// data stream manifest. If not, the default pipeline name is returned.
func (dsm *DataStreamManifest) GetPipelineNameOrDefault() string {
if dsm.Elasticsearch != nil && dsm.Elasticsearch.IngestPipeline != nil && dsm.Elasticsearch.IngestPipeline.Name != "" {
return dsm.Elasticsearch.IngestPipeline.Name
if dsm.Elasticsearch != nil && dsm.Elasticsearch.IndexTemplate != nil && dsm.Elasticsearch.IndexTemplate.IngestPipeline != nil && dsm.Elasticsearch.IndexTemplate.IngestPipeline.Name != "" {
return dsm.Elasticsearch.IndexTemplate.IngestPipeline.Name
}
return defaultPipelineName
}
Expand Down