template

package
v6.0.0-alpha2+incompat... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ESClient

type ESClient interface {
	LoadJSON(path string, json map[string]interface{}) ([]byte, error)
	Request(method, path string, pipeline string, params map[string]string, body interface{}) (int, []byte, error)
	GetVersion() string
}

TemplateLoader is a subset of the Elasticsearch client API capable of loading the template.

type Field

type Field struct {
	Name          string `config:"name"`
	Type          string `config:"type"`
	Description   string `config:"description"`
	Format        string `config:"format"`
	ScalingFactor int    `config:"scaling_factor"`
	Fields        Fields `config:"fields"`
	ObjectType    string `config:"object_type"`
	// contains filtered or unexported fields
}

type Fields

type Fields []Field

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(cfg *common.Config, client ESClient, beatInfo common.BeatInfo) (*Loader, error)

func (*Loader) CheckTemplate

func (l *Loader) CheckTemplate(templateName string) bool

CheckTemplate checks if a given template already exist. It returns true if and only if Elasticsearch returns with HTTP status code 200.

func (*Loader) Generate

func (l *Loader) Generate() error

Generate generates the template and writes it to a file based on the configuration from `output_to_file`.

func (*Loader) Load

func (l *Loader) Load() error

Load checks if the index mapping template should be loaded In case the template is not already loaded or overwriting is enabled, the template is written to index

func (*Loader) LoadTemplate

func (l *Loader) LoadTemplate(templateName string, template map[string]interface{}) error

LoadTemplate loads a template into Elasticsearch overwriting the existing template if it exists. If you wish to not overwrite an existing template then use CheckTemplate prior to calling this method.

type OutputToFile

type OutputToFile struct {
	Path    string `config:"path"`
	Version string `config:"version"`
}

OutputToFile contains the configuration options for generating and writing the template into a file.

type Template

type Template struct {
	// contains filtered or unexported fields
}

func New

func New(beatVersion string, esVersion string, index string, settings templateSettings) (*Template, error)

New creates a new template instance

func (*Template) GetName

func (t *Template) GetName() string

GetName returns the name of the template which is {index}-{version}

func (*Template) Load

func (t *Template) Load(file string) (common.MapStr, error)

Load the given input and generates the input based on it

type TemplateConfig

type TemplateConfig struct {
	Enabled      bool             `config:"enabled"`
	Name         string           `config:"name"`
	Fields       string           `config:"fields"`
	Overwrite    bool             `config:"overwrite"`
	Settings     templateSettings `config:"settings"`
	OutputToFile OutputToFile     `config:"output_to_file"`
}

type Version

type Version struct {
	// contains filtered or unexported fields
}

func NewVersion

func NewVersion(version string) (*Version, error)

NewVersion expects a string in the format: major.minor.bugfix(-meta)

func (*Version) IsMajor

func (v *Version) IsMajor(major int) bool

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL