elastic

package
v0.0.0-...-b1b21d8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: LGPL-3.0 Imports: 11 Imported by: 0

README

功能介绍

  1. 基于requests 实现的es客户端

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, option ClientOption) (*Client, error)

func (*Client) Count

func (obj *Client) Count(ctx context.Context, index string, data any) (int64, error)

func (*Client) Delete

func (obj *Client) Delete(ctx context.Context, deleteData DeleteData, deleteDatas ...DeleteData) error

func (*Client) Exists

func (obj *Client) Exists(ctx context.Context, index, id string) (bool, error)

func (Client) Ping

func (obj Client) Ping(ctx context.Context) error

func (*Client) Search

func (obj *Client) Search(ctx context.Context, index string, data any) (SearchResult, error)

func (*Client) Update

func (obj *Client) Update(ctx context.Context, updateData UpdateData, updateDatas ...UpdateData) error

func (*Client) Upsert

func (obj *Client) Upsert(ctx context.Context, updateData UpdateData, updateDatas ...UpdateData) error

type ClientOption

type ClientOption struct {
	BaseUrl string
	Host    string
	Port    int
	Usr     string
	Pwd     string
	Ssl     bool
}

type DeleteData

type DeleteData struct {
	Index string
	Id    string
}

type SearchResult

type SearchResult struct {
	Total int64
	Datas []gjson.Result
}

type UpdateData

type UpdateData struct {
	Index string
	Id    string
	Data  any
}

Jump to

Keyboard shortcuts

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