elasticsearch

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartImportTask added in v0.0.9

func StartImportTask(task *ImportTask)

Types

type BulkIndexByScrollResponse added in v0.0.6

type BulkIndexByScrollResponse struct {
	*elastic.BulkIndexByScrollResponse
}

type BulkResponse added in v0.0.6

type BulkResponse struct {
	*elastic.BulkResponse
}

type Config added in v0.0.6

type Config struct {
	Url      string `json:"url,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	CertPath string `json:"certPath,omitempty"`
}

type DeleteResponse added in v0.0.6

type DeleteResponse struct {
	*elastic.DeleteResponse
}

type HitData added in v0.0.6

type HitData struct {
	Index   string `json:"_index,omitempty"`   // index name
	Type    string `json:"_type,omitempty"`    // type meta field
	Id      string `json:"_id,omitempty"`      // external or internal
	Uid     string `json:"_uid,omitempty"`     // uid meta field (see MapperService.java for all meta fields)
	Version *int64 `json:"_version,omitempty"` // version number, when Version is set to true in SearchService
	Source  string `json:"_source,omitempty"`  // stored document source
}

type IService

type IService interface {
	Stop()
	Info() (res *elastic.NodesInfoResponse, err error)
	DeleteIndex(indexName string) (err error)
	CreateIndex(indexName string, bodyJSON map[string]interface{}) (err error)
	Indexes() (indexes []*IndexInfo, err error)
	GetMapping(indexName string) (res interface{}, err error)
	PutMapping(indexName string, bodyJSON map[string]interface{}) (err error)
	SetFieldType(indexName string, fieldName string, fieldType string) (err error)
	Search(indexName string, pageIndex int, pageSize int, whereList []*Where, orderList []*Order) (res *SearchResult, err error)
	Insert(indexName string, id string, doc interface{}) (res *InsertResponse, err error)
	InsertNotWait(indexName string, id string, doc interface{}) (res *InsertResponse, err error)
	BatchInsertNotWait(docs []*InsertDoc) (res *BulkResponse, err error)
	Update(indexName string, id string, doc interface{}) (res *UpdateResponse, err error)
	Delete(indexName string, id string) (res *DeleteResponse, err error)
	Reindex(sourceIndexName string, toIndexName string) (res *BulkIndexByScrollResponse, err error)
	IndexStat(indexName string) (res *IndicesStatsResponse, err error)
	Scroll(indexName string, scrollId string, pageSize int, whereList []*Where, orderList []*Order) (res *SearchResult, err error)
	IndexAlias(indexName string, aliasName string) (res *IndexAliasResponse, err error)
}

func New added in v0.0.6

func New(config Config) (IService, error)

type ImportTask added in v0.0.9

type ImportTask struct {
	*Task
	ImportType string `json:"importType,omitempty"`

	Id         string                `json:"id,omitempty"`
	ColumnList []*StrategyDataColumn `json:"columnList"`
}

type IndexAliasResponse added in v0.0.6

type IndexAliasResponse struct {
	*elastic.AliasResult
}

type IndexInfo added in v0.0.6

type IndexInfo struct {
	IndexName string `json:"indexName"`
}

type IndicesStatsResponse added in v0.0.6

type IndicesStatsResponse struct {
	*elastic.IndicesStatsResponse
}

type InsertDoc added in v0.0.6

type InsertDoc struct {
	IndexName string
	Id        string
	Doc       interface{}
}

type InsertResponse added in v0.0.6

type InsertResponse struct {
	*elastic.IndexResponse
}

type Order added in v0.0.6

type Order struct {
	Name    string `json:"name"`
	AscDesc string `json:"ascDesc"`
}

type SearchResult added in v0.0.6

type SearchResult struct {
	TotalHits *elastic.TotalHits `json:"total,omitempty"`     // total number of hits found
	MaxScore  *float64           `json:"max_score,omitempty"` // maximum score of all hits
	Hits      []*HitData         `json:"hits,omitempty"`      // the actual hits returned
}

type StrategyDataColumn added in v0.0.9

type StrategyDataColumn struct {
	Name        string `json:"name,omitempty"`
	Value       string `json:"value,omitempty"`
	ReuseNumber int    `json:"reuseNumber,omitempty"`
}

type Task added in v0.0.9

type Task struct {
	IndexName string `json:"indexName,omitempty"`
	TaskId    string `json:"taskId,omitempty"`

	DataNumber    int   `json:"dataNumber,omitempty"`
	BatchNumber   int   `json:"batchNumber,omitempty"`
	ThreadNumber  int   `json:"threadNumber,omitempty"`
	ErrorContinue bool  `json:"errorContinue"`
	UseTime       int64 `json:"useTime"`

	IsEnd     bool      `json:"isEnd"`
	StartTime time.Time `json:"startTime,omitempty"`
	NowTime   time.Time `json:"nowTime,omitempty"`
	EndTime   time.Time `json:"endTime,omitempty"`
	Error     string    `json:"error,omitempty"`
	IsStop    bool      `json:"isStop"`
	Service   IService  `json:"-"`

	ReadyDataStatisticsList []*data_engine.DataStatistics `json:"readyDataStatisticsList"`
	DoDataStatisticsList    []*data_engine.DataStatistics `json:"doDataStatisticsList"`

	ReadyDataStatistics *data_engine.DataStatistics `json:"readyDataStatistics"`
	DoDataStatistics    *data_engine.DataStatistics `json:"doDataStatistics"`
	// contains filtered or unexported fields
}

func CleanTask added in v0.0.9

func CleanTask(taskKey string) *Task

func GetTask added in v0.0.9

func GetTask(taskKey string) *Task

func StopTask added in v0.0.9

func StopTask(taskKey string) *Task

func (*Task) Start added in v0.0.9

func (this_ *Task) Start()

func (*Task) Statistics added in v0.0.9

func (this_ *Task) Statistics()

func (*Task) StatisticsList added in v0.0.9

func (this_ *Task) StatisticsList(list []*data_engine.DataStatistics) (statistics *data_engine.DataStatistics)

func (*Task) Stop added in v0.0.9

func (this_ *Task) Stop()

type UpdateResponse added in v0.0.6

type UpdateResponse struct {
	*elastic.UpdateResponse
}

type V7Service added in v0.0.6

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

V7Service 注册处理器在线信息等

func (*V7Service) BatchInsertNotWait added in v0.0.6

func (this_ *V7Service) BatchInsertNotWait(docs []*InsertDoc) (res *BulkResponse, err error)

func (*V7Service) CreateIndex added in v0.0.6

func (this_ *V7Service) CreateIndex(indexName string, bodyJSON map[string]interface{}) (err error)

func (*V7Service) Delete added in v0.0.6

func (this_ *V7Service) Delete(indexName string, id string) (res *DeleteResponse, err error)

func (*V7Service) DeleteIndex added in v0.0.6

func (this_ *V7Service) DeleteIndex(indexName string) (err error)

func (*V7Service) GetClient added in v0.0.6

func (this_ *V7Service) GetClient() (client *elastic.Client, err error)

func (*V7Service) GetMapping added in v0.0.6

func (this_ *V7Service) GetMapping(indexName string) (res interface{}, err error)

func (*V7Service) IndexAlias added in v0.0.6

func (this_ *V7Service) IndexAlias(indexName string, aliasName string) (res *IndexAliasResponse, err error)

func (*V7Service) IndexStat added in v0.0.6

func (this_ *V7Service) IndexStat(indexName string) (res *IndicesStatsResponse, err error)

func (*V7Service) Indexes added in v0.0.6

func (this_ *V7Service) Indexes() (indexes []*IndexInfo, err error)

func (*V7Service) Info added in v0.0.6

func (this_ *V7Service) Info() (res *elastic.NodesInfoResponse, err error)

func (*V7Service) Insert added in v0.0.6

func (this_ *V7Service) Insert(indexName string, id string, doc interface{}) (res *InsertResponse, err error)

func (*V7Service) InsertNotWait added in v0.0.6

func (this_ *V7Service) InsertNotWait(indexName string, id string, doc interface{}) (res *InsertResponse, err error)

func (*V7Service) PutMapping added in v0.0.6

func (this_ *V7Service) PutMapping(indexName string, bodyJSON map[string]interface{}) (err error)

func (*V7Service) Reindex added in v0.0.6

func (this_ *V7Service) Reindex(sourceIndexName string, toIndexName string) (res *BulkIndexByScrollResponse, err error)

func (*V7Service) Scroll added in v0.0.6

func (this_ *V7Service) Scroll(indexName string, scrollId string, pageSize int, whereList []*Where, orderList []*Order) (res *SearchResult, err error)

func (*V7Service) Search added in v0.0.6

func (this_ *V7Service) Search(indexName string, pageIndex int, pageSize int, whereList []*Where, orderList []*Order) (res *SearchResult, err error)

func (*V7Service) SetFieldType added in v0.0.6

func (this_ *V7Service) SetFieldType(indexName string, fieldName string, fieldType string) (err error)

func (*V7Service) Stop added in v0.0.6

func (this_ *V7Service) Stop()

func (*V7Service) Update added in v0.0.6

func (this_ *V7Service) Update(indexName string, id string, doc interface{}) (res *UpdateResponse, err error)

type Where added in v0.0.6

type Where struct {
	Name                    string `json:"name"`
	Value                   string `json:"value"`
	Before                  string `json:"before"`
	After                   string `json:"after"`
	CustomSql               string `json:"customSql"`
	SqlConditionalOperation string `json:"sqlConditionalOperation"`
	AndOr                   string `json:"andOr"`
}

Jump to

Keyboard shortcuts

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