elasticsearch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ElasticV5 = "5"
	ElasticV6 = "6"
	ElasticV7 = "7"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregations

type Aggregations struct {
	ContainerCount   `json:"container_count"`
	LogCountOverTime `json:"log_count_over_time"`
}

type Aggs

type Aggs struct {
	*CardinalityAggregation   `json:"container_count,omitempty"`
	*DateHistogramAggregation `json:"log_count_over_time,omitempty"`
}

type Body

type Body struct {
	From   int64               `json:"from,omitempty"`
	Size   int64               `json:"size,omitempty"`
	Sorts  []map[string]string `json:"sort,omitempty"`
	*Query `json:"query,omitempty"`
	*Aggs  `json:"aggs,omitempty"`
}

More info: https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-search-API.html

type Bool

type Bool struct {
	Filter             []Match `json:"filter,omitempty"`
	Should             []Match `json:"should,omitempty"`
	MinimumShouldMatch int32   `json:"minimum_should_match,omitempty"`
}

Example: {bool: {filter: <[]Match>}} {bool: {should: <[]Match>, minimum_should_match: 1}}

type Bucket

type Bucket struct {
	Time  int64 `json:"key"`
	Count int64 `json:"doc_count"`
}

type Cardinality

type Cardinality struct {
	Field string `json:"field,omitempty"`
}

type CardinalityAggregation

type CardinalityAggregation struct {
	*Cardinality `json:"cardinality,omitempty"`
}

type ContainerCount

type ContainerCount struct {
	Value int64 `json:"value"`
}

type DateHistogram

type DateHistogram struct {
	Field    string `json:"field,omitempty"`
	Interval string `json:"interval,omitempty"`
}

type DateHistogramAggregation

type DateHistogramAggregation struct {
	*DateHistogram `json:"date_histogram,omitempty"`
}

type Elasticsearch

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

Elasticsearch implement logging interface

func NewElasticsearch

func NewElasticsearch(options *Options) (*Elasticsearch, error)

func (*Elasticsearch) ClearScroll

func (es *Elasticsearch) ClearScroll(id string)

func (*Elasticsearch) CountLogsByInterval

func (es *Elasticsearch) CountLogsByInterval(sf logging.SearchFilter, interval string) (logging.Histogram, error)

func (*Elasticsearch) ExportLogs

func (es *Elasticsearch) ExportLogs(sf logging.SearchFilter, w io.Writer) error

func (*Elasticsearch) GetCurrentStats

func (es *Elasticsearch) GetCurrentStats(sf logging.SearchFilter) (logging.Statistics, error)

func (*Elasticsearch) SearchLogs

func (es *Elasticsearch) SearchLogs(sf logging.SearchFilter, f, s int64, o string) (logging.Logs, error)

type Hit

type Hit struct {
	Source `json:"_source"`
	Sort   []int64 `json:"sort"`
}

type Hits

type Hits struct {
	Total   interface{} `json:"total"` // `As of Elasticsearch v7.x, hits.total is changed incompatibly
	AllHits []Hit       `json:"hits"`
}

type Kubernetes

type Kubernetes struct {
	Namespace string `json:"namespace_name"`
	Pod       string `json:"pod_name"`
	Container string `json:"container_name"`
	Host      string `json:"host"`
}

type LogCountOverTime

type LogCountOverTime struct {
	Buckets []Bucket `json:"buckets"`
}

type Match

type Match struct {
	*Bool             `json:"bool,omitempty"`
	MatchPhrase       map[string]string `json:"match_phrase,omitempty"`
	MatchPhrasePrefix map[string]string `json:"match_phrase_prefix,omitempty"`
	Regexp            map[string]string `json:"regexp,omitempty"`
	*Range            `json:"range,omitempty"`
}

Example: []Match [

{
  bool: <Bool>
},
{
  match_phrase: {
    <string>: <string>
  }
},
...

]

type Options

type Options struct {
	Host        string `json:"host" yaml:"host"`
	IndexPrefix string `json:"indexPrefix,omitempty" yaml:"indexPrefix"`
	Version     string `json:"version" yaml:"version"`
}

func NewElasticSearchOptions

func NewElasticSearchOptions() *Options

func (*Options) AddFlags

func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options)

func (*Options) ApplyTo

func (s *Options) ApplyTo(options *Options)

func (*Options) Validate

func (s *Options) Validate() []error

type Query

type Query struct {
	Bool `json:"bool,omitempty"`
}

type Range

type Range struct {
	*Time `json:"time,omitempty"`
}

type Response

type Response struct {
	ScrollId     string `json:"_scroll_id,omitempty"`
	Hits         `json:"hits,omitempty"`
	Aggregations `json:"aggregations,omitempty"`
}

type Source

type Source struct {
	Log        string `json:"log"`
	Time       string `json:"time"`
	Kubernetes `json:"kubernetes"`
}

type Time

type Time struct {
	Gte *time.Time `json:"gte,omitempty"`
	Lte *time.Time `json:"lte,omitempty"`
}

Directories

Path Synopsis
versions
v5
v6
v7

Jump to

Keyboard shortcuts

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