config

package
v5.0.86 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 4 Imported by: 22

Documentation

Overview

Package config allows parsing a configuration for Elasticsearch from a URL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL         string
	Index       string
	Username    string
	Password    string
	Shards      int
	Replicas    int
	Sniff       *bool
	Healthcheck *bool
	Infolog     string
	Errorlog    string
	Tracelog    string
}

Config represents an Elasticsearch configuration.

func Parse

func Parse(elasticURL string) (*Config, error)

Parse returns the Elasticsearch configuration by extracting it from the URL, its path, and its query string.

Example:

http://127.0.0.1:9200/store-blobs?shards=1&replicas=0&sniff=false&tracelog=elastic.trace.log

The code above will return a URL of http://127.0.0.1:9200, an index name of store-blobs, and the related settings from the query string.

Jump to

Keyboard shortcuts

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