mappings

package
v0.0.0-...-d983439 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// The format of the date string on the end of the index name
	TimeseriesDateFmt = "2006.01.02"
	//run info for telematics
	NodeCurrentRunInfoVersion = "1"

	IndexNameNodeRunInfo = nodeAndVersionRunInfo + "-run-info"
)

Variables

AllMappings is the list of all mappings that we currently have and it is used by our `InitializeStore()` interface, if we add more mappings to this list, the function will automatically initialize them

View Source
var ConvergeHistory = Mapping{
	Index:      "converge-history",
	Timeseries: true,
	Mapping: `
	{
		"index_patterns": ["converge-history-*"],
		"settings": {
			"number_of_shards": 5,
			"index": {
				"refresh_interval": "5s"
			}
		},
		"mappings": {
			"dynamic": false,
			"properties": {
				"entity_uuid": {
					"type": "keyword"
				},
				"timestamp": {
					"type": "date",
					"format": "strict_date_optional_time||epoch_millis"
				},
				"expanded_run_list": {
					"type": "object",
					"properties": {
						"id": {
							"type": "keyword"
						},
						"run_list": {
							"type": "object",
							"properties": {
								"name": {
									"type": "keyword",
									"index": false,
									"doc_values": false
								},
								"skipped": {
									"type": "boolean"
								},
								"type": {
									"type": "keyword",
									"index": false,
									"doc_values": false,
									"ignore_above": 256
								}
							}
						}
					}
				},
				"node_name": {
					"type": "keyword"
				},
				"organization_name": {
					"type": "keyword"
				},
				"resources": {
					"type": "object",
					"dynamic": true,
					"properties": {
						"name": {
							"type": "keyword"
						},
						"id": {
							"type": "keyword"
						},
						"duration": {
							"type": "integer"
						},
						"delta": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"ignore_failure": {
							"type": "boolean"
						},
						"result": {
							"type": "keyword"
						},
						"status": {
							"type": "keyword"
						},
						"cookbook_name": {
							"type": "keyword",
							"index": false,
							"doc_values": false
						},
						"cookbook_type": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"recipe_name": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"conditional": {
							"type": "keyword",
							"index": false,
							"doc_values": false
						}
					}
				},
				"run_id": {
					"type": "keyword"
				},
				"run_list": {
					"type": "keyword"
				},
				"start_time": {
					"type": "date",
					"format": "strict_date_optional_time||epoch_millis"
				},
				"end_time": {
					"type": "date",
					"format": "strict_date_optional_time||epoch_millis"
				},
				"source": {
					"type": "keyword"
				},
				"status": {
					"type": "keyword"
				},
				"total_resource_count": {
					"type": "integer"
				},
				"updated_resource_count": {
					"type": "integer"
				},
				"deprecations": {
					"type": "object",
					"dynamic": true,
					"properties": {
						"message": {
							"type": "text",
							"fielddata": false,
							"norms": false
						},
						"url": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"location": {
							"type": "keyword",
							"index": false,
							"doc_values": false
						}
					}
				},
				"error": {
					"type": "object",
					"properties": {
						"class": {
							"type": "keyword",
							"index": false,
							"doc_values": false
						},
						"message": {
							"type": "text",
							"fielddata": false,
							"norms": false
						},
						"backtrace": {
							"type": "keyword",
							"index": false,
							"doc_values": false
						},
						"description": {
							"type": "object",
							"dynamic": true
						}
					}
				},
				"tags": {
					"type": "keyword"
				},
				"event_action": {
					"type": "keyword"
				},
				"resource_names": {
					"type": "keyword"
				},
				"recipes": {
					"type": "keyword"
				},
				"chef_tags": {
					"type": "keyword"
				},
				"cookbooks": {
					"type": "keyword"
				},
				"platform": {
					"type": "keyword"
				},
				"platform_family": {
					"type": "keyword"
				},
				"platform_version": {
					"type": "keyword"
				},
				"chef_version": {
					"type": "keyword"
				},
				"uptime_seconds": {
					"type": "long"
				},
				"environment": {
					"type": "keyword"
				},
				"roles": {
					"type": "keyword"
				},
				"ec2": {
					"type": "object",
					"properties": {
						"instance_id": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"instance_type": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"placement_availability_zone": {
							"type": "keyword",
							"index": false,
							"doc_values": false,
							"ignore_above": 256
						},
						"public_ipv4": {
							"type": "ip"
						},
						"account_id": {
							"type": "keyword"
						},
						"region": {
							"type": "keyword"
						}
					}
				},
				"policy_group": {
					"type": "keyword"
				},
				"policy_name": {
					"type": "keyword"
				},
				"policy_revision": {
					"type": "keyword"
				},
				"fqdn": {
					"type": "keyword",
					"index": false,
					"doc_values": false,
					"ignore_above": 256
				},
				"ipaddress": {
					"type": "ip"
				},
				"source_fqdn": {
					"type": "keyword",
					"index": false,
					"doc_values": false,
					"ignore_above": 256
				},
				"versioned_cookbooks": {
					"type": "nested",
					"properties":{
						"name": { "type": "keyword", "ignore_above": 256 },
						"version": { "type": "keyword", "ignore_above": 256 }
					}
				},
				"cloud_provider": {
					"type": "keyword"
				},
				"timezone": {
					"type": "keyword"
				},
				"kernel_release": {
					"type": "keyword"
				},
				"kernel_version": {
					"type": "keyword"
				},
				"virtualization_system": {
					"type": "keyword"
				},
				"virtualization_role": {
					"type": "keyword"
				},
				"dmi_system_manufacturer": {
					"type": "keyword"
				},
				"dmi_system_serial_number": {
					"type": "keyword"
				},
				"domain": {
					"type": "keyword"
				},
				"hostname": {
					"type": "keyword"
				},
				"macaddress": {
					"type": "keyword"
				},
				"memory_total": {
					"type": "keyword"
				},
				"ip6address": {
					"type": "ip"
				}
			}
		}
	}
	`,
}

ConvergeHistory is the representation of our `converge-history` Mapping

View Source
var NodeAttribute = Mapping{
	Index:      "node-attribute",
	Timeseries: false,
	Properties: fmt.Sprintf(`{ %s }`, attrProps),
	Mapping: fmt.Sprintf(`
	{
		"settings": {
			"number_of_shards": 5,
			"index": {
				"refresh_interval": "5s"
			}
		},
		"mappings": {
				%s
		}
	}
	`, attrProps),
}

NodeAttribute is the representation of our `node-state` Mapping

View Source
var NodeRunInfo = Mapping{
	Index:      IndexNameNodeRunInfo,
	Timeseries: false,
	Properties: fmt.Sprintf(`{ %s }`, runInfoProps),
	Mapping: fmt.Sprintf(`
	{
		"settings": {
			"number_of_shards": 5,
			"index": {
				"refresh_interval": "1s" 
			} 
		}, 
		"mappings": {
				%s 
		} 
	}`, runInfoProps),
}

NodeRunInfo mapping used to create the `config-mgmt-run-info index

View Source
var NodeState = Mapping{
	Index:      "node-state-7",
	Alias:      "node-state",
	Timeseries: false,
	Properties: fmt.Sprintf(`{ %s }`, nodeProps),
	Mapping: fmt.Sprintf(`
	{
		"settings": {
			"number_of_shards": 5,
			"index": {
				"refresh_interval": "5s"
			},
			 "analysis": {
				"normalizer": {
					"case_insensitive": {
						"type": "custom",
						"char_filter": [],
						"filter": ["lowercase", "asciifolding"]
					}
				},
				"analyzer": {
					"autocomplete": {
						"tokenizer": "autocomplete_tokenizer",
						"filter": [
							"lowercase"
						]
					}
				},
				"tokenizer": {
					"autocomplete_tokenizer": {
						"type": "edge_ngram",
						"min_gram": 2,
						"max_gram": 20,
						"token_chars": [
							"letter",
							"digit",
							"punctuation"
						]
					}
				}
			}
		},
		"mappings": {
				%s
		}
	}
	`, nodeProps),
}

NodeState is the representation of our `node-state` Mapping

Functions

This section is empty.

Types

type Mapping

type Mapping struct {
	Index      string
	Alias      string
	Timeseries bool
	Mapping    string
	Properties string
}

Mapping type is the representation of an ES mapping, it contains all the necessary fields you need to create a mapping and to insert documents to it

func (*Mapping) IndexTimeseriesFmt

func (m *Mapping) IndexTimeseriesFmt(date time.Time) string

Index will return the name of the index plus a date string associated to the Mapping. The format will be (index-name) -YYYY.MM.DD

func (*Mapping) IndexTimeseriesScanDate

func (m *Mapping) IndexTimeseriesScanDate(indexName string) (time.Time, error)

Jump to

Keyboard shortcuts

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