es

package
v0.10.3 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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