pelastic

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

针对ElasticSearch V7.X 版本

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	V7 *Es7
}

func Instance

func Instance(conf ElastiConfig) (c *Client, err error)

Instance 客户端链接实例化

type ElastiConfig

type ElastiConfig struct {
	Nodes []string // 服务节点,多个节点用“|”链接
	Auth  struct {
		Username string // 用户名
		Password string // 密码
	}
	HealthCheck     bool   // 节点健康检查
	DefaultProtocol string // 请求协议
	Version         int    // 主版本号,需与服务端用的主版本号保持一致, 例如 7=Elasticsearch7.xx, 8=Elasticsearch8.xx
}

type Es7

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

func (*Es7) CreateDoc

func (es *Es7) CreateDoc(indexName string, bodyContent string) (_id string, err error)

CreateDoc 创建文档 indexName: string 索引名 bodyContent: string

func (*Es7) CreateIndex

func (es *Es7) CreateIndex(indexName string, mappings string) (bool, error)

CreateIndex 创建索引 indexName: string 索引名 mappings: interface{} 指定索引映射

func (*Es7) DeleteIndex

func (es *Es7) DeleteIndex(indexNames []string) (bool, error)

DeleteIndex 删除索引 indexNames: []string 索引名切片

func (*Es7) IndexExists

func (es *Es7) IndexExists(indexName string) (bool, error)

IndexExists 检测指定index 是否存在 indexName: string 索引名

Jump to

Keyboard shortcuts

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