esx

package
v0.0.0-...-619fe92 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

使用 ElasticSearch 前端页面的 Request 进行数据拉取,减少构造请求的工作量

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonMarshalString

func JsonMarshalString(v interface{}) string

Types

type ES

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

func New

func New(cfg elasticsearch.Config) (*ES, error)

func (*ES) SearchWithRaw

func (e *ES) SearchWithRaw(index string, jsonBody string, handler func(string)) error

type ESTyped

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

func NewTypedClient

func NewTypedClient(cfg elasticsearch.Config) (*ESTyped, error)

func (*ESTyped) SearchWithRaw

func (e *ESTyped) SearchWithRaw(index string, jsonBody string, from, size int, handler func(id string, fields map[string]json.RawMessage) bool) error

SearchWithRaw 使用 Elasticsearch 的 Inspect 里 Request 数据进行数据拉取,可自定义起始位置和每次拉取的数据量 最多只能拉取 10000 条数据

func (*ESTyped) SearchWithRawByPIT

func (e *ESTyped) SearchWithRawByPIT(index string, jsonBody string, size, intervalhours int, handler func(id string, fields map[string]json.RawMessage) bool) error

SearchWithRawByPIT 使用 Elasticsearch 的 Inspect 里 Request 数据进行数据拉取,可自定义起始位置、每次拉取的数据量和时间间隔 时间间隔参数用于指定每次搜索的时间范围,单位为小时,避免一次搜索数据量过大,导致es服务内存占用过高 使用 Elasticsearch 的 PointInTime API,https://www.elastic.co/guide/en/elasticsearch/reference/current/point-in-time-api.html 可遍历超过10000条数据

Jump to

Keyboard shortcuts

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