elasticsearch

package
v0.0.0-...-cc18b67 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeFieldName

func EscapeFieldName(name string) string

EscapeFieldName escapes field names for Elasticsearch

func NotificationToMaps

func NotificationToMaps(datasetID string,
	notification *pb.Notification) ([]map[string]interface{}, error)

NotificationToMaps converts a gNMI Notification into a map[string][interface] that adheres to the Data schema defined in schema.go

func SetKey

func SetKey(m map[string]interface{}, key interface{}) error

SetKey fills a Data map's relevant key if the key is a simple type.

func SetValue

func SetValue(m map[string]interface{}, val interface{}) error

SetValue fills a Data map's relevant Value fields

Types

type Data

type Data struct {
	// The timestamp in nanosecond resolution
	Timestamp uint64
	// Organization ID
	OrgID       string
	DatasetType string
	// The datasetID
	DatasetID string
	// The stringified path
	Path string
	// The codec encoded key
	Key []byte
	// The key data
	// this array will have each entry as an object with "name" field
	// and "<type>" field for value.
	// If name is not set, the data is put in one of the simple type fields
	// The problem with nested types is that each entry in the array is creating a doc
	// and the number of docs is exploding which is not good.
	// So one optimization is to flatten for simple values and not use the nested field.
	KeyData   []*field `json:",omitempty"`
	KeyString *string  `json:",omitempty"`
	KeyDouble *float64 `json:",omitempty"`
	KeyLong   *int64   `json:",omitempty"`
	KeyBool   *bool    `json:",omitempty"`
	KeyPtr    *string  `json:",omitempty"`
	// If the simple string looks like an ip address
	// we also index it here as ip address
	KeyIP string `json:",omitempty"`
	// If the simple string looks like a mac address
	// we also index it here as mac address
	KeyMAC string `json:",omitempty"`
	// The value data
	// this array will have each entry as an object with "name" field
	// and "<type>" field for value.
	// If name is not set, the data was a simple value
	// The problem with nested types is that each entry in the array is creating a doc
	// and the number of docs is exploding which is not good.
	// So one optimization is to flatten for simple values and not use the nested field.
	Value       []*field `json:",omitempty"`
	ValueString *string  `json:",omitempty"`
	ValueDouble *float64 `json:",omitempty"`
	ValueLong   *int64   `json:",omitempty"`
	ValueBool   *bool    `json:",omitempty"`
	ValuePtr    *string  `json:",omitempty"`
	// If the simple string looks like an ip address
	// we also index it here as ip address
	ValueIP string `json:",omitempty"`
	// If the simple string looks like a mac address
	// we also index it here as mac address
	ValueMAC string `json:",omitempty"`

	// Present when it's a delete
	// In this case, value will not be present
	Del *bool `json:",omitempty"`
	// Present when it's a deleteAll
	// In this case, key and value will not be present
	DelAll *bool `json:",omitempty"`
}

Data represents the document format for a notification

Jump to

Keyboard shortcuts

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