nes

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

nes

license Language Build Status GoDoc Go Report Card

Documentation

Index

Constants

View Source
const (
	// DefaultIndexMaxResultWindow - The default value of from + size for searches to this index.
	// Defaults to 10000.
	DefaultIndexMaxResultWindow = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkRequest

type BulkRequest = esapi.BulkRequest

BulkRequest -

type Client

type Client = es.Client

Client represents the Elasticsearch client.

func MustNewESClient

func MustNewESClient(config *ESConfig) *Client

MustNewESClient -

func NewESClient

func NewESClient(config *ESConfig) (*Client, error)

NewESClient -

type CountRequest

type CountRequest = esapi.CountRequest

CountRequest -

type CreateRequest added in v0.2.5

type CreateRequest = esapi.CreateRequest

CreateRequest -

type DeleteByQueryRequest

type DeleteByQueryRequest = esapi.DeleteByQueryRequest

DeleteByQueryRequest -

type DeleteRequest

type DeleteRequest = esapi.DeleteRequest

DeleteRequest -

type ESConfig

type ESConfig struct {
	Addrs    []string `yaml:"addrs"`
	Username string   `yaml:"username"`
	Password string   `yaml:"password"`
}

ESConfig -

type ESOper

type ESOper interface {
	ESClient() *Client

	Get(ctx context.Context, model interface{}, index string, id string, opts ...func(*GetRequest)) (interface{}, error)

	MultiGet(ctx context.Context, model interface{}, index string, ids []string, opts ...func(*MgetRequest)) (interface{}, error)

	// Bulk allows to perform multiple index/update/delete operations in a single request.
	//
	// See full documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html.
	Bulk(ctx context.Context, index string, writeReqBody func(ctx context.Context, buf *bytes.Buffer) error, opts ...func(*BulkRequest)) error

	Create(ctx context.Context, index string, id string, obj interface{}, opts ...func(*CreateRequest)) error
	Index(ctx context.Context, index string, id string, obj interface{}, opts ...func(*IndexRequest)) error

	Delete(ctx context.Context, id string, index string, opts ...func(*DeleteRequest)) error
	DeleteByQuery(ctx context.Context, query string, indexes []string, opts ...func(*DeleteByQueryRequest)) error
	DeleteByQueryTemplate(ctx context.Context, t *TemplateParam, indexes []string, opts ...func(*DeleteByQueryRequest)) error

	UpdateByQuery(ctx context.Context, query string, indexes []string, opts ...func(*UpdateByQueryRequest)) error
	UpdateByQueryTemplate(ctx context.Context, t *TemplateParam, indexes []string, opts ...func(*UpdateByQueryRequest)) error

	Count(ctx context.Context, query string, indexes []string, opts ...func(*CountRequest)) (int64, error)
	CountTemplate(ctx context.Context, t *TemplateParam, indexes []string, opts ...func(*CountRequest)) (int64, error)
	Search(ctx context.Context, model interface{}, query string, indexes []string, opts ...func(*SearchRequest)) (interface{}, error)
	SearchTemplate(ctx context.Context, model interface{}, t *TemplateParam, indexes []string, opts ...func(*SearchRequest)) (interface{}, error)
	// Scroll allows to retrieve a large numbers of results from a single search request.
	//
	// We no longer recommend using the scroll API for deep pagination.
	// If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT).
	// See documentation at https://www.elastic.co/guide/en/elasticsearch/reference/master/paginate-search-results.html#scroll-search-results
	SearchByScrollID(ctx context.Context, model interface{}, scrollID string, opts ...func(*ScrollRequest)) (interface{}, error)
}

ESOper -

func NewESOper

func NewESOper(client *Client) ESOper

NewESOper -

type GetRequest added in v0.2.5

type GetRequest = esapi.GetRequest

GetRequest -

type IndexRequest

type IndexRequest = esapi.IndexRequest

IndexRequest -

type MgetRequest added in v0.2.5

type MgetRequest = esapi.MgetRequest

MgetRequest -

type Response

type Response = esapi.Response

Response -

type ScrollRequest

type ScrollRequest = esapi.ScrollRequest

ScrollRequest -

type SearchRequest

type SearchRequest = esapi.SearchRequest

SearchRequest -

type TemplateParam

type TemplateParam struct {
	Template *ntemplate.TextTemplate
	Data     interface{}
	Name     string
}

TemplateParam -

type UpdateByQueryRequest

type UpdateByQueryRequest = esapi.UpdateByQueryRequest

UpdateByQueryRequest -

type UpdateRequest added in v0.2.5

type UpdateRequest = esapi.UpdateRequest

UpdateRequest -

Jump to

Keyboard shortcuts

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