client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCluster  = "http://localhost:9200"
	DefaultUser     = ""
	DefaultPassword = ""
	DefaultAlias    = ""
)
View Source
var DisablePrettyJSON = false

Functions

func PrintPrettyMap

func PrintPrettyMap(query map[string]interface{})

Types

type Client

type Client struct {
	Alias     string
	KibanaUrl string
	History   []Record `json:"history"`
	// contains filtered or unexported fields
}

func New

func New() (*Client, error)

func NewFromBookmarks

func NewFromBookmarks(conf bookmarks.Bookmark) (*Client, error)

func NewFromParams

func NewFromParams(host, alias, user, password string) (*Client, error)

func (*Client) Alive

func (c *Client) Alive() bool

func (*Client) ClusterName

func (c *Client) ClusterName() (string, error)

func (*Client) Export

func (c *Client) Export(indexName string, body string) (*searchResponse, error)

func (*Client) GetDsl

func (c *Client) GetDsl(sql string) (dsl, index string, err error)

func (*Client) IndexInfo

func (c *Client) IndexInfo(indexNames string) (map[string]interface{}, error)

func (*Client) Indices

func (c *Client) Indices() ([]interface{}, error)

func (*Client) Info

func (c *Client) Info() (map[string]interface{}, error)

func (*Client) ManageIndex

func (c *Client) ManageIndex(index string, action string) error

func (*Client) Mapping

func (c *Client) Mapping(indexName string) (map[string]interface{}, error)

func (*Client) Query

func (c *Client) Query(sql string) (*searchResponse, error)

func (*Client) QueryRows

func (c *Client) QueryRows(indexName string, opts RowsOptions) (*searchResponse, error)

func (*Client) Search

func (c *Client) Search(indexName string, body string) (*searchResponse, error)

func (*Client) SearchWithBody

func (c *Client) SearchWithBody(index, body string) (map[string]interface{}, error)

func (*Client) SetServerVersion

func (c *Client) SetServerVersion()

func (*Client) Settings

func (c *Client) Settings(indexName string) (map[string]interface{}, error)

func (*Client) Stats

func (c *Client) Stats(indexName string) (map[string]interface{}, error)

func (*Client) Tasks

func (c *Client) Tasks() (map[string]interface{}, error)

type Dump

type Dump struct {
	Index  string
	Fields []string
}

Dump represents a database dump

func (*Dump) Export

func (d *Dump) Export(c *Client, writer io.Writer) error

func (*Dump) Migrate

func (d *Dump) Migrate(c *Client, dstHost, dstUser, dstPass, dstIndex string, numItems int) error

type Pagination

type Pagination struct {
	Rows    int64 `json:"rows_count"`
	Page    int64 `json:"page"`
	Pages   int64 `json:"pages_count"`
	PerPage int64 `json:"per_page"`
}

type Record

type Record struct {
	Query     string `json:"query"`
	Timestamp string `json:"timestamp"`
}

type Row

type Row []interface{}

type RowsOptions

type RowsOptions struct {
	Where      string // Custom filter
	Offset     int    // Number of rows to skip
	Limit      int    // Number of rows to fetch
	SortColumn string // Column to sort by
	SortOrder  string // Sort direction (ASC, DESC)
}

type Table

type Table struct {
	Columns    []string    `json:"columns"`
	Rows       []Row       `json:"rows"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

func (*Table) CSV

func (res *Table) CSV(withHeader bool) []byte

func (*Table) Format

func (res *Table) Format() []map[string]interface{}

func (*Table) JSON

func (res *Table) JSON() []byte

Jump to

Keyboard shortcuts

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