mappings

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The format of the date string on the end of the index name
	TimeseriesDateFmt = "2006.01.02"
)

Variables

View Source
var Actions = Mapping{
	Index:      "actions",
	Type:       "actions",
	Timeseries: true,
	Mapping: `
	{
		"template": "actions-*",
		"index_patterns": ["actions-*"],
		"settings": {
			"index": {
				"refresh_interval": "5s"
			}
		},
		"mappings": {
			"actions": {
				"dynamic": false,
				"properties": {
					"entity_name": {
						"type": "keyword",
						"ignore_above": 256
					},
					"entity_type": {
						"type": "keyword",
						"ignore_above": 256
					},
					"entity_uuid": {
						"type": "keyword",
						"ignore_above": 256
					},
					"id": {
						"type": "keyword",
						"ignore_above": 256
					},
					"organization_name": {
						"type": "keyword",
						"ignore_above": 256
					},
					"remote_hostname": {
						"type": "keyword",
						"ignore_above": 256
					},
					"requestor_name": {
						"type": "keyword",
						"ignore_above": 256
					},
					"run_id": {
						"type": "keyword",
						"ignore_above": 256
					},
					"service_hostname": {
						"type": "keyword",
						"ignore_above": 256
					},
					"source": {
						"type": "keyword",
						"ignore_above": 256
					},
					"task": {
						"type": "keyword",
						"ignore_above": 256
					},
					"user_agent": {
						"type": "keyword",
						"ignore_above": 256
					},
					"revision_id": {
						"type": "keyword",
						"ignore_above": 256
					},
					"data": {
						"type": "text",
						"index": "false"
					},
					"recorded_at": {
						"type": "date",
						"format": "strict_date_optional_time||epoch_millis"
					},
					"projects": {
						"type": "keyword"
					}
				}
			}
		}
	}
`,
}

Actions is the representation of our `actions` Mapping

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",
	Type:       "converge",
	Timeseries: true,
	Mapping: `
	{
		"template": "converge-history-*",
		"index_patterns": ["converge-history-*"],
		"settings": {
			"index": {
				"refresh_interval": "5s"
			}
		},
		"mappings": {
			"converge": {
				"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"
							}
						}
					},
					"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 }
						}
					}
				}
			}
		}
	}
	`,
}

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

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

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

View Source
var NodeState = Mapping{
	Index:      "node-state-5",
	Alias:      "node-state",
	Type:       "node-state",
	Timeseries: false,
	Properties: fmt.Sprintf(`{ %s }`, nodeProps),
	Mapping: fmt.Sprintf(`
	{
		"template": "node-state",
		"index_patterns": ["node-state"],
		"settings": {
			"index": {
				"refresh_interval": "5s"
			},
			 "analysis": {
				"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": {
			"node-state": {
				"dynamic": false,
				%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
	Type       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

Jump to

Keyboard shortcuts

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