es

package
v0.10.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package es contains a minimal API client to query Elastic Search and export complete indexes.

As of now, it can only return all results for a given index.

Index

Constants

View Source
const (
	HttpClientTimeout = time.Duration(5 * time.Second)
	HttpUserAgent     = "qvain"
	HttpQueryString   = "_search?size=10000"
)

Configuration for http client

View Source
const (
	FilterSourcesPath = "hits.hits.#._source"
	FilterCountPath   = "hits.hits.#"
)

Configuration for json path getter

Variables

This section is empty.

Functions

func Filter

func Filter(json []byte) []byte

Filter returns the contents of the Json _sources key from the Elastic Search response, effectively filtering out some ES noise.

func FilterAndCount

func FilterAndCount(json []byte) ([]byte, int64)

FilterAndCount returns the contents of the _sources key just like Filter(), but also returns a count of the number of elements to facilitate sanity checks. It is twice as slow as Filter().

Types

type ESClient

type ESClient struct {
	// contains filtered or unexported fields
}

ESClient describes the parameters needed to query an Elastic Search instance.

func NewClient

func NewClient(url string) *ESClient

NewClient creates a new client for Elastic Search. It takes a url parameter pointing to the root of the ES API endpoint.

func (*ESClient) All

func (es *ESClient) All(index, doctype string) ([]byte, error)

AllForIndex does a _search query without search parameters for the specified index, returning all results.

Jump to

Keyboard shortcuts

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