elastic

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2017 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// TODO: make this configurable / detectable.
	// Limiting to 10MiB lets us work on small AWS clusters, but unnecessarily
	// increases round trips in larger or non-AWS clusters
	MaxBulkSize = 10 * 1024 * 1024
	BulkWorkers = 10
)

Variables

This section is empty.

Functions

func ResolveAWSCredentials added in v0.2.0

func ResolveAWSCredentials(config *Config, aws_config *aws.Config) *credentials.Credentials

ResolveAWSCredentials returns Credentials object

Order of resolution 1. Static Credentials - As configured in Indexer config 2. EC2 Instance Role Credentials

Types

type Client

type Client struct {
	IndexName string
	ProjectID string
	Client    *elastic.Client
	// contains filtered or unexported fields
}

func FromEnv

func FromEnv(projectID string) (*Client, error)

FromEnv creates an Elasticsearch client from the `ELASTIC_CONNECTION_INFO` environment variable

func NewClient

func NewClient(config *Config) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) CreateIndex

func (c *Client) CreateIndex() error

CreateIndex creates an index matching that created by gitlab-elasticsearch-git v1.1.1

func (*Client) DeleteIndex

func (c *Client) DeleteIndex() error

func (*Client) Flush

func (c *Client) Flush() error

func (*Client) Get

func (c *Client) Get(id string) (*elastic.GetResult, error)

We only really use this for tests

func (*Client) GetBlob

func (c *Client) GetBlob(path string) (*elastic.GetResult, error)

func (*Client) GetCommit

func (c *Client) GetCommit(id string) (*elastic.GetResult, error)

func (*Client) Index

func (c *Client) Index(id string, thing interface{})

func (*Client) ParentID

func (c *Client) ParentID() string

func (*Client) Remove

func (c *Client) Remove(id string)

type Config

type Config struct {
	IndexName string   `json:"-"`
	ProjectID string   `json:"-"`
	URL       []string `json:"url"`
	AWS       bool     `json:"aws"`
	Region    string   `json:"aws_region"`
	AccessKey string   `json:"aws_access_key"`
	SecretKey string   `json:"aws_secret_access_key"`
}

func ReadConfig

func ReadConfig(r io.Reader) (*Config, error)

Jump to

Keyboard shortcuts

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