Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(x int) int
- func BuildSearchHighlight(highlightParam *SearchHighlightParam) util.MapStr
- func BuildSearchTermAggregations(params []SearchAggParam) util.MapStr
- func BuildSearchTermFilter(filterParam SearchFilterParam) []util.MapStr
- func GetDateHistogramIntervalField(distribution, version string, bucketSize string) (string, error)
- func GetIndexTypes(client API, indexName string) (map[string]interface{}, error)
- func GetShardID(esMajorVersion int, docID []byte, numberOfShards int) int
- func GetShardIDWithRoutingOffset(esMajorVersion int, docID []byte, numberOfShards int, routingNumShards int, ...) int
- func IsHostAvailable(host string) bool
- func IsHostDead(host string) bool
- func ParseActionMeta(data []byte) (action, index, typeName, id, routing string, err error)
- func ParseUrlLevelBulkMeta(pathStr string) (urlLevelIndex, urlLevelType string)
- func RegisterInstance(cfg ElasticsearchConfig, handler API)
- func RegisterMetadataChangeEvent(evt MetadataChangeEvent)
- func RemoveDotFromIndexName(indexName, dotReplaceTo string) string
- func RemoveHostsByClusterID(clusterID string)
- func RemoveInstance(elastic string)
- func SafetyAddNewlineBetweenData(buffer *bytebufferpool.ByteBuffer, data []byte)
- func SetMetadata(k string, v *ElasticsearchMetadata)
- func UpdateBulkMetadata(action string, scannedByte []byte, index, typeName, id string) (newBytes []byte, err error)
- func UpdateClient(cfg ElasticsearchConfig, handler API)
- func UpdateConfig(cfg ElasticsearchConfig)
- func ValidateBulkRequest(where, body string)
- func WalkBulkRequests(pathStr string, data []byte, ...) (int, error)
- func WalkConfigs(walkFunc func(key, value interface{}) bool)
- func WalkHosts(walkFunc func(key, value interface{}) bool)
- func WalkMetadata(walkFunc func(key, value interface{}) bool)
- type AAIR_Alias
- type AAIR_Indices
- type API
- type APIContext
- type Aggregation
- type AggregationRequest
- type AggregationResponse
- type AliasAction
- type AliasActionBody
- type AliasAndIndicesResponse
- type AliasDetailInfo
- type AliasIndex
- type AliasInfo
- type AliasRequest
- type BoolQuery
- type BoundValuesResult
- type Bucket
- type BucketBase
- type BulkActionMetadata
- type BulkBuffer
- func (receiver *BulkBuffer) Add(id string, data []byte)
- func (receiver *BulkBuffer) GetMessageBytes() []byte
- func (receiver *BulkBuffer) GetMessageCount() int
- func (receiver *BulkBuffer) GetMessageSize() int
- func (receiver *BulkBuffer) Reset()
- func (receiver *BulkBuffer) ResetData()
- func (receiver *BulkBuffer) SafetyEndWithNewline()
- func (receiver *BulkBuffer) Write(data []byte)
- func (receiver *BulkBuffer) WriteByteBuffer(data []byte)
- func (receiver *BulkBuffer) WriteErrorReason(reason string)
- func (receiver *BulkBuffer) WriteMessageID(id string)
- func (receiver *BulkBuffer) WriteNewByteBufferLine(tag string, data []byte)
- func (receiver *BulkBuffer) WriteStringBuffer(data string)
- type BulkBufferPool
- type BulkDetail
- type BulkDetailItem
- type BulkIndexMetadata
- type BulkProcessor
- type BulkProcessorConfig
- type BulkResponse
- type BulkResponseParseConfig
- type BulkResult
- type BulkStats
- type BulkSummary
- type BulkSummaryItem
- type CatIndexResponse
- type CatNodeResponse
- type CatShardResponse
- type ClusterHealth
- type ClusterInformation
- type ClusterRoutingTable
- type ClusterState
- type ClusterStateNodes
- type ClusterStats
- type Collapse
- type CommandRequest
- type CommonCommand
- type CountResponse
- type DeleteByQueryResponse
- type DeleteResponse
- type DiscoveryResult
- type ElasticField
- type ElasticFieldType
- type ElasticsearchConfig
- type ElasticsearchMetadata
- func (metadata *ElasticsearchMetadata) CheckNodeTrafficThrottle(node string, req, dataSize, maxWaitInMS int)
- func (meta *ElasticsearchMetadata) GetActiveEndpoint() string
- func (meta *ElasticsearchMetadata) GetActiveHost() string
- func (meta *ElasticsearchMetadata) GetActiveHosts() int
- func (meta *ElasticsearchMetadata) GetActivePreferredEndpoint(host string) string
- func (meta *ElasticsearchMetadata) GetActivePreferredEndpoints(hosts []string) string
- func (metadata *ElasticsearchMetadata) GetActivePreferredHost(host string) string
- func (meta *ElasticsearchMetadata) GetActivePreferredSeedEndpoint() string
- func (meta *ElasticsearchMetadata) GetActivePreferredSeedHost() string
- func (metadata *ElasticsearchMetadata) GetHttpClient(host string) *fasthttp.Client
- func (metadata *ElasticsearchMetadata) GetIndexPrimaryShardRoutingTable(index string, shard int) (*IndexShardRouting, error)
- func (metadata *ElasticsearchMetadata) GetIndexPrimaryShardsRoutingTable(index string) ([]IndexShardRouting, error)
- func (metadata *ElasticsearchMetadata) GetIndexRoutingTable(index string) (map[string][]IndexShardRouting, error)
- func (metadata *ElasticsearchMetadata) GetIndexSetting(index string) (string, *util.MapStr, error)
- func (metadata *ElasticsearchMetadata) GetIndexStats(indexName string) (*util.MapStr, error)
- func (meta *ElasticsearchMetadata) GetMajorVersion() int
- func (meta *ElasticsearchMetadata) GetNodeInfo(nodeID string) *NodesInfo
- func (meta *ElasticsearchMetadata) GetPrimaryShardInfo(index string, shardID string) (*IndexShardRouting, error)
- func (meta *ElasticsearchMetadata) GetSchema() string
- func (meta *ElasticsearchMetadata) GetSeedHosts() []string
- func (metadata *ElasticsearchMetadata) GetValue(s string) (interface{}, error)
- func (meta *ElasticsearchMetadata) Init(health bool)
- func (meta *ElasticsearchMetadata) IsAvailable() bool
- func (meta *ElasticsearchMetadata) IsTLS() bool
- func (metadata *ElasticsearchMetadata) LastSuccess() time.Time
- func (metadata *ElasticsearchMetadata) NewHttpClient(host string) *fasthttp.Client
- func (meta *ElasticsearchMetadata) PrepareEndpoint(host string) string
- func (meta *ElasticsearchMetadata) ReportFailure(errorMessage error) bool
- func (meta *ElasticsearchMetadata) ReportSuccess()
- type ErrorDetail
- type ErrorResponse
- type EventAction
- type FieldCap
- type FieldCapsResponse
- type GeoLocation
- type GetResponse
- type HostMetadata
- type IndexConfig
- type IndexDocument
- type IndexInfo
- type IndexLevelStats
- type IndexMetadata
- type IndexShardRouting
- type IndexStats
- type IndicesStats
- type InsertResponse
- type InternalError
- type LocalNodeInfo
- type MappingAPI
- type MatchQuery
- type MetadataChangeEvent
- type MetadataConfig
- type MonitorConfig
- type NodeAvailable
- func (node *NodeAvailable) FailureTickets() int
- func (node *NodeAvailable) IsAvailable() bool
- func (node *NodeAvailable) IsDead() bool
- func (node *NodeAvailable) LastCheck() time.Time
- func (node *NodeAvailable) LastSuccess() time.Time
- func (node *NodeAvailable) ReportFailure()
- func (node *NodeAvailable) ReportSuccess()
- type NodeConfig
- type NodeMetadata
- type NodePayload
- type NodesInfo
- type NodesResponse
- type NodesStats
- type PartitionInfo
- type PartitionQuery
- type Query
- type QueryStringQuery
- type RangeQuery
- type ReindexResponse
- type ReplicationAPI
- type ResponseBase
- func (this *ResponseBase) GetBoolByJsonPath(path string) (interface{}, error)
- func (this *ResponseBase) GetBytesByJsonPath(path string) ([]byte, error)
- func (this *ResponseBase) GetIntByJsonPath(path string) (interface{}, error)
- func (this *ResponseBase) GetStringByJsonPath(path string) (interface{}, error)
- type RetryRule
- type RetryRules
- type RootCause
- type ScriptAPI
- type ScrollAPI
- type ScrollResponse
- func (scroll *ScrollResponse) GetDocs() []IndexDocument
- func (scroll *ScrollResponse) GetHitsTotal() int64
- func (scroll *ScrollResponse) GetScrollId() string
- func (scroll *ScrollResponse) GetShardResponse() ShardResponse
- func (v ScrollResponse) MarshalEasyJSON(w *jwriter.Writer)
- func (v ScrollResponse) MarshalJSON() ([]byte, error)
- func (scroll *ScrollResponse) SetScrollId(id string)
- func (v *ScrollResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ScrollResponse) UnmarshalJSON(data []byte) error
- type ScrollResponseAPI
- type ScrollResponseV7
- func (scroll *ScrollResponseV7) GetDocs() []IndexDocument
- func (scroll *ScrollResponseV7) GetHitsTotal() int64
- func (scroll *ScrollResponseV7) GetScrollId() string
- func (scroll *ScrollResponseV7) GetShardResponse() ShardResponse
- func (v ScrollResponseV7) MarshalEasyJSON(w *jwriter.Writer)
- func (v ScrollResponseV7) MarshalJSON() ([]byte, error)
- func (scroll *ScrollResponseV7) SetScrollId(id string)
- func (v *ScrollResponseV7) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *ScrollResponseV7) UnmarshalJSON(data []byte) error
- type SearchAggParam
- type SearchFilterParam
- type SearchHighlightParam
- type SearchRequest
- type SearchResponse
- type SearchTemplate
- type SearchTemplateHistory
- type SecurityAPI
- type Setting
- type ShardInfo
- type ShardResponse
- type Stats
- type TaskConfig
- type TemplateAPI
- type TermsAggregationQuery
- type TermsQuery
- type TraceMeta
- type TraceTemplate
- type UpdateByQueryResponse
- type Version
- type VersionInfo
- type View
- type ViewRequest
Constants ¶
const ( ElasticsearchConfigSourceFile = "file" ElasticsearchConfigSourceElasticsearch = "elastic" )
const ( ModeAgent = "agent" ModeAgentless = "agentless" )
const ( Elasticsearch = "elasticsearch" Easysearch = "easysearch" Opensearch = "opensearch" )
const ( PartitionByDate = "date" PartitionByKeyword = "keyword" PartitionByNumber = "number" )
const GlobalSystemElasticsearchID = "global_system_elasticsearch_id"
const KVElasticClusterSettings = "kv_elastic_cluster_settings"
const KVElasticIndexMetadata = "kv_elastic_index_metadata"
const KVElasticNodeMetadata = "kv_elastic_node_metadata"
const QueueElasticIndexHealthStatus = "elasticsearch##metadata##index_health_change"
const QueueElasticIndexState = "elasticsearch##metadata##index_state_change_v1"
Variables ¶
var ActionCreate = "create"
var ActionDelete = "delete"
var ActionEnd = []byte("\"")
var ActionIndex = "index"
var ActionStart = []byte("\"")
var ActionUpdate = "update"
var Actions = []string{ActionIndex, ActionDelete, ActionCreate, ActionUpdate}
var DefaultBulkProcessorConfig = BulkProcessorConfig{ BulkMaxDocsCount: 1000, BulkSizeInMb: 10, Compress: false, RetryDelayInSeconds: 1, RejectDelayInSeconds: 1, MaxRejectRetryTimes: 0, DeadletterRequestsQueue: "bulk_dead_requests", InvalidRequestsQueue: "bulk_invalid_requests", BulkResponseParseConfig: BulkResponseParseConfig{ BulkResultMessageMaxRequestBodyLength: 10 * 1024, BulkResultMessageMaxResponseBodyLength: 10 * 1024, BulkResultMessageQueue: "bulk_result_messages", SaveSuccessBulkResultToMessageQueue: false, SaveErrorBulkResultToMessageQueue: true, SaveBusyBulkResultToMessageQueue: true, OutputBulkStats: false, IncludeErrorDetails: true, IncludeIndexStats: true, IncludeActionStats: true, MaxItemOfErrorDetailsCount: 50, }, RetryRules: RetryRules{Retry429: true, Default: true, Retry4xx: false}, RequestTimeoutInSecond: 60, }
var NEWLINEBYTES = []byte("\n")
Functions ¶
func BuildSearchHighlight ¶
func BuildSearchHighlight(highlightParam *SearchHighlightParam) util.MapStr
func BuildSearchTermAggregations ¶
func BuildSearchTermAggregations(params []SearchAggParam) util.MapStr
func BuildSearchTermFilter ¶
func BuildSearchTermFilter(filterParam SearchFilterParam) []util.MapStr
func GetIndexTypes ¶
func IsHostAvailable ¶
func IsHostDead ¶
func ParseActionMeta ¶
func ParseUrlLevelBulkMeta ¶
func RegisterInstance ¶
func RegisterInstance(cfg ElasticsearchConfig, handler API)
* 注册elastic实例,初始化elastic metadata并保存到metas(sync.Map{})
cfg.ID = cfg.Name = 集群名称
把handle(API)保存到apis(sync.Map)
把ElasticsearchConfig保存到cfgs(sync.Map)
func RegisterMetadataChangeEvent ¶
func RegisterMetadataChangeEvent(evt MetadataChangeEvent)
RegisterMetadataChangeEvent register a metadata change event
func RemoveDotFromIndexName ¶
func RemoveHostsByClusterID ¶
func RemoveHostsByClusterID(clusterID string)
func RemoveInstance ¶
func RemoveInstance(elastic string)
func SafetyAddNewlineBetweenData ¶
func SafetyAddNewlineBetweenData(buffer *bytebufferpool.ByteBuffer, data []byte)
func SetMetadata ¶
func SetMetadata(k string, v *ElasticsearchMetadata)
func UpdateBulkMetadata ¶ added in v1.1.2
func UpdateClient ¶
func UpdateClient(cfg ElasticsearchConfig, handler API)
func UpdateConfig ¶
func UpdateConfig(cfg ElasticsearchConfig)
func ValidateBulkRequest ¶
func ValidateBulkRequest(where, body string)
func WalkBulkRequests ¶
func WalkBulkRequests(pathStr string, data []byte, eachLineFunc func(eachLine []byte) (skipNextLine bool), metaFunc func(metaBytes []byte, actionStr, index, typeName, id, routing string, offset int) (err error), payloadFunc func(payloadBytes []byte, actionStr, index, typeName, id, routing string), operationFunc func(actionStr, index, typeName, id, routing string)) (int, error)
func WalkConfigs ¶
func WalkConfigs(walkFunc func(key, value interface{}) bool)
Types ¶
type AAIR_Alias ¶
type AAIR_Indices ¶
type API ¶
type API interface {
ScrollAPI
MappingAPI
TemplateAPI
ReplicationAPI
SecurityAPI
ScriptAPI
InitDefaultTemplate(templateName, indexPrefix string)
GetMajorVersion() int
ClusterHealth(ctx context.Context) (*ClusterHealth, error)
ClusterHealthSpecEndpoint(ctx context.Context, endPoint string, level string) (*ClusterHealth, error)
GetClusterState() (*ClusterState, error)
GetClusterStats(ctx context.Context, node string) (*ClusterStats, error)
GetClusterStatsSpecEndpoint(ctx context.Context, node string, endPoint string) (*ClusterStats, error)
GetNodesStats(nodeID, host string, level string) *NodesStats
GetIndicesStats() *IndicesStats
GetVersion() Version
CreateIndex(name string, settings map[string]interface{}) error
Index(indexName, docType string, id interface{}, data interface{}, refresh string) (*InsertResponse, error)
Update(indexName, docType string, id interface{}, data interface{}, refresh string) (*InsertResponse, error)
Bulk(data []byte) (*util.Result, error)
Get(indexName, docType, id string) (*GetResponse, error)
Delete(indexName, docType, id string, refresh ...string) (*DeleteResponse, error)
Count(ctx context.Context, indexName string, body []byte) (*CountResponse, error)
Search(indexName string, query *SearchRequest) (*SearchResponse, error)
QueryDSL(ctx context.Context, indexName string, queryArgs *[]util.KV, queryDSL []byte) (*SearchResponse, error)
SearchWithRawQueryDSL(indexName string, queryDSL []byte) (*SearchResponse, error)
GetIndexSettings(indexNames string) (*util.MapStr, error)
UpdateIndexSettings(indexName string, settings map[string]interface{}) error
IndexExists(indexName string) (bool, error)
DeleteIndex(name string) error
Refresh(name string) (err error)
GetNodes() (*map[string]NodesInfo, error)
GetNodeInfo(nodeID string) (*NodesInfo, error)
GetIndices(pattern string) (*map[string]IndexInfo, error)
GetPrimaryShards() (*map[string]map[int]ShardInfo, error)
GetAliases() (*map[string]AliasInfo, error)
GetAliasesDetail() (*map[string]AliasDetailInfo, error)
GetAliasesAndIndices() (*AliasAndIndicesResponse, error)
SearchTasksByIds(ids []string) (*SearchResponse, error)
Reindex(body []byte) (*ReindexResponse, error)
DeleteByQuery(indexName string, body []byte) (*DeleteByQueryResponse, error)
UpdateByQuery(indexName string, body []byte) (*UpdateByQueryResponse, error)
GetIndexStats(indexName string) (*util.MapStr, error)
GetStats() (*Stats, error)
Forcemerge(indexName string, maxCount int) error
SetSearchTemplate(templateID string, body []byte) error
DeleteSearchTemplate(templateID string) error
RenderTemplate(body map[string]interface{}) ([]byte, error)
SearchTemplate(body map[string]interface{}) ([]byte, error)
Alias(body []byte) error
FieldCaps(target string) ([]byte, error)
CatShards() ([]CatShardResponse, error)
CatShardsSpecEndpoint(endPoint string) ([]CatShardResponse, error)
CatNodes(colStr string) ([]CatNodeResponse, error)
GetIndexRoutingTable(index string) (map[string][]IndexShardRouting, error)
GetClusterSettings(values url.Values) (map[string]interface{}, error)
UpdateClusterSettings(body []byte) error
GetIndex(indexName string) (map[string]interface{}, error)
Exists(target string) (bool, error)
GetILMPolicy(target string) (map[string]interface{}, error)
PutILMPolicy(target string, policyConfig []byte) error
DeleteILMPolicy(target string) error
GetRemoteInfo() ([]byte, error)
Flush(indexName string) ([]byte, error)
ClusterAllocationExplain(ctx context.Context, body []byte, params url.Values) ([]byte, error)
}
type APIContext ¶
type Aggregation ¶
type Aggregation struct {
}
type AggregationRequest ¶
type AggregationRequest struct {
Aggregations map[string]Aggregation `json:"aggregations,omitempty"`
}
type AggregationResponse ¶
type AggregationResponse struct {
Buckets []BucketBase `json:"buckets,omitempty"`
Value interface{} `json:"value,omitempty"`
}
type AliasAction ¶
type AliasActionBody ¶
type AliasActionBody struct {
Index string `json:"index,omitempty"`
Alias string `json:"alias"`
Indices []string `json:"indices,omitempty"`
Filter map[string]interface{} `json:"filter,omitempty"`
Routing string `json:"routing,omitempty"`
SearchRouting string `json:"search_routing,omitempty"`
IndexRouting string `json:"index_routing,omitempty"`
IsWriteIndex bool `json:"is_write_index,omitempty"`
}
type AliasAndIndicesResponse ¶
type AliasAndIndicesResponse struct {
Aliases []AAIR_Alias `json:"aliases"`
Indices []AAIR_Indices `json:"indices"`
}
type AliasDetailInfo ¶
type AliasDetailInfo struct {
Alias string `json:"alias,omitempty"`
Indexes []AliasIndex `json:"indexes,omitempty"`
WriteIndex string `json:"write_index,omitempty"`
}
type AliasIndex ¶
type AliasRequest ¶
type AliasRequest struct {
Actions []AliasAction `json:"actions"`
}
type BoolQuery ¶
type BoolQuery struct {
Must []interface{} `json:"must,omitempty"`
MustNot []interface{} `json:"must_not,omitempty"`
Should []interface{} `json:"should,omitempty"`
}
BoolQuery wrapper queries
type BoundValuesResult ¶
type Bucket ¶
type Bucket struct {
KeyAsString interface{} `json:"key_as_string,omitempty"`
Key interface{} `json:"key,omitempty"`
DocCount int64 `json:"doc_count,omitempty"`
}
type BucketBase ¶
type BucketBase map[string]interface{}
type BulkActionMetadata ¶
type BulkActionMetadata struct {
Index *BulkIndexMetadata `json:"index,omitempty"`
Delete *BulkIndexMetadata `json:"delete,omitempty"`
Create *BulkIndexMetadata `json:"create,omitempty"`
Update *BulkIndexMetadata `json:"update,omitempty"`
Stats int `json:"-,omitempty"`
}
func (*BulkActionMetadata) GetItem ¶
func (meta *BulkActionMetadata) GetItem() *BulkIndexMetadata
type BulkBuffer ¶
type BulkBuffer struct {
Queue string
MessageIDs []string
Reason []string
// contains filtered or unexported fields
}
func (*BulkBuffer) Add ¶
func (receiver *BulkBuffer) Add(id string, data []byte)
func (*BulkBuffer) GetMessageBytes ¶
func (receiver *BulkBuffer) GetMessageBytes() []byte
func (*BulkBuffer) GetMessageCount ¶
func (receiver *BulkBuffer) GetMessageCount() int
func (*BulkBuffer) GetMessageSize ¶
func (receiver *BulkBuffer) GetMessageSize() int
func (*BulkBuffer) Reset ¶
func (receiver *BulkBuffer) Reset()
func (*BulkBuffer) ResetData ¶
func (receiver *BulkBuffer) ResetData()
func (*BulkBuffer) SafetyEndWithNewline ¶
func (receiver *BulkBuffer) SafetyEndWithNewline()
func (*BulkBuffer) Write ¶
func (receiver *BulkBuffer) Write(data []byte)
func (*BulkBuffer) WriteByteBuffer ¶
func (receiver *BulkBuffer) WriteByteBuffer(data []byte)
func (*BulkBuffer) WriteErrorReason ¶
func (receiver *BulkBuffer) WriteErrorReason(reason string)
func (*BulkBuffer) WriteMessageID ¶
func (receiver *BulkBuffer) WriteMessageID(id string)
func (*BulkBuffer) WriteNewByteBufferLine ¶
func (receiver *BulkBuffer) WriteNewByteBufferLine(tag string, data []byte)
func (*BulkBuffer) WriteStringBuffer ¶
func (receiver *BulkBuffer) WriteStringBuffer(data string)
type BulkBufferPool ¶
type BulkBufferPool struct {
// contains filtered or unexported fields
}
func NewBulkBufferPool ¶
func NewBulkBufferPool(tag string, maxSize, maxItems uint32) *BulkBufferPool
func (*BulkBufferPool) AcquireBulkBuffer ¶
func (pool *BulkBufferPool) AcquireBulkBuffer() *BulkBuffer
func (*BulkBufferPool) ReturnBulkBuffer ¶
func (pool *BulkBufferPool) ReturnBulkBuffer(item *BulkBuffer)
type BulkDetail ¶
type BulkDetail struct {
Failure BulkDetailItem `json:"failure,omitempty"`
Invalid BulkDetailItem `json:"invalid,omitempty"`
}
type BulkDetailItem ¶
type BulkIndexMetadata ¶
type BulkIndexMetadata struct {
Index string `json:"_index,omitempty"`
Type string `json:"_type,omitempty"`
ID string `json:"_id,omitempty"`
Pipeline string `json:"pipeline,omitempty"`
Refresh string `json:"refresh,omitempty"`
Source interface{} `json:"_source,omitempty"`
SourceExcludes interface{} `json:"_source_excludes,omitempty"`
SourceIncludes interface{} `json:"_source_includes,omitempty"`
RetryOnConflict interface{} `json:"retry_on_conflict,omitempty"`
RequireAlias interface{} `json:"require_alias,omitempty"`
Parent1 interface{} `json:"_parent,omitempty"`
Parent2 interface{} `json:"parent,omitempty"`
Routing1 interface{} `json:"routing,omitempty"`
Routing2 interface{} `json:"_routing,omitempty"`
Version1 interface{} `json:"_version,omitempty"`
Version2 interface{} `json:"version,omitempty"`
//for bulk response
Result string `json:"result,omitempty"`
SeqNo int64 `json:"_seq_no,omitempty"`
PrimaryTerm int64 `json:"_primary_term,omitempty"`
Shards *struct{} `json:"_shards,omitempty"`
ErrorResponse
}
type BulkProcessor ¶
type BulkProcessor struct {
Config BulkProcessorConfig
BulkBufferPool *BulkBufferPool
HttpPool *fasthttp.RequestResponsePool
}
func NewBulkProcessor ¶
func NewBulkProcessor(tag, esClusterID string, cfg BulkProcessorConfig) BulkProcessor
func (*BulkProcessor) Bulk ¶
func (joint *BulkProcessor) Bulk(ctx context.Context, tag string, metadata *ElasticsearchMetadata, host string, buffer *BulkBuffer) (continueNext bool, statsRet map[int]int, bulkResult *BulkResult, err error)
bulkResult is valid only if max_reject_retry_times == 0
type BulkProcessorConfig ¶
type BulkProcessorConfig struct {
BulkSizeInKb int `config:"batch_size_in_kb,omitempty"`
BulkSizeInMb int `config:"batch_size_in_mb,omitempty"`
BulkMaxDocsCount int `config:"batch_size_in_docs,omitempty"`
Compress bool `config:"compress"`
RetryDelayInSeconds int `config:"retry_delay_in_seconds"`
RejectDelayInSeconds int `config:"reject_retry_delay_in_seconds"`
MaxRejectRetryTimes int `config:"max_reject_retry_times"`
RequestTimeoutInSecond int `config:"request_timeout_in_second"`
InvalidRequestsQueue string `config:"invalid_queue"`
DeadletterRequestsQueue string `config:"dead_letter_queue"`
RetryRules RetryRules `config:"retry_rules"`
BulkResponseParseConfig BulkResponseParseConfig `config:"response_handle"`
RemoveDuplicatedNewlines bool `config:"remove_duplicated_newlines"`
// contains filtered or unexported fields
}
func (*BulkProcessorConfig) GetBulkSizeInBytes ¶
func (this *BulkProcessorConfig) GetBulkSizeInBytes() int
type BulkResponse ¶
type BulkResponse struct {
Took int `json:"took"`
Errors bool `json:"errors"`
Items []BulkActionMetadata `json:"items"`
}
type BulkResponseParseConfig ¶
type BulkResponseParseConfig struct {
SaveSuccessBulkResultToMessageQueue bool `config:"save_success_results"`
SaveErrorBulkResultToMessageQueue bool `config:"save_error_results"`
SaveBusyBulkResultToMessageQueue bool `config:"save_busy_results"`
//save bulk results to message queue, include versions
OutputVersions bool `config:"output_result_versions"`
ResultVersionsQueueName string `config:"result_versions_queue_name"`
OutputBulkStats bool `config:"output_bulk_stats"`
IncludeIndexStats bool `config:"include_index_stats"`
IncludeActionStats bool `config:"include_action_stats"`
IncludeErrorDetails bool `config:"include_error_details"`
MaxItemOfErrorDetailsCount int `config:"max_error_details_count"`
BulkResultMessageQueue string `config:"bulk_result_message_queue"`
BulkResultMessageMaxRequestBodyLength int `config:"max_request_body_size"`
BulkResultMessageMaxResponseBodyLength int `config:"max_response_body_size"`
}
type BulkResult ¶
type BulkResult struct {
Error bool `json:"error,omitempty"`
ErrorMsgs []string `json:"error_msgs,omitempty"`
Codes []int `json:"codes,omitempty"`
Indices []string `json:"indices,omitempty"`
Actions []string `json:"actions,omitempty"`
Summary BulkSummary `json:"summary,omitempty"`
Stats BulkStats `json:"stats,omitempty"`
Detail BulkDetail `json:"detail,omitempty"`
Versions []VersionInfo `json:"versions,omitempty"`
}
func HandleBulkResponse ¶
func HandleBulkResponse(req *fasthttp.Request, resp *fasthttp.Response, tag util.MapStr, requestBytes, resbody []byte, successItems *BulkBuffer, nonRetryableItems, retryableItems *BulkBuffer, options BulkResponseParseConfig, retryRules RetryRules) (bool, map[int]int, *BulkResult)
type BulkSummary ¶
type BulkSummary struct {
Failure BulkSummaryItem `json:"failure,omitempty"`
Invalid BulkSummaryItem `json:"invalid,omitempty"`
Success BulkSummaryItem `json:"success,omitempty"`
}
type BulkSummaryItem ¶
type CatIndexResponse ¶
type CatIndexResponse struct {
Health string `json:"health,omitempty"`
Status string `json:"status,omitempty"`
Index string `json:"index,omitempty"`
Uuid string `json:"uuid,omitempty"`
Pri string `json:"pri,omitempty"`
Rep string `json:"rep,omitempty"`
DocsCount string `json:"docs.count,omitempty"`
DocsDeleted string `json:"docs.deleted,omitempty"`
StoreSize string `json:"store.size,omitempty"`
PriStoreSize string `json:"pri.store.size,omitempty"`
SegmentCount string `json:"segments.count,omitempty"`
}
type CatNodeResponse ¶
type CatNodeResponse struct {
Id string `json:"id"`
Ip string `json:"ip"`
Port string `json:"port"`
HeapPercent string `json:"heap.percent"`
RamPercent string `json:"ram.percent"`
Cpu string `json:"cpu"`
Load1M string `json:"load_1m"`
Load5M interface{} `json:"load_5m"`
Load15M interface{} `json:"load_15m"`
NodeRole string `json:"node.role"`
Master string `json:"master"`
Name string `json:"name"`
DiskAvail string `json:"disk.avail"`
DiskUsed string `json:"disk.used"`
Shards int `json:"shards,omitempty"`
Uptime string `json:"uptime"`
HeapMax string `json:"heap.max"`
}
type CatShardResponse ¶
type CatShardResponse struct {
Index string `json:"index,omitempty"`
ShardID string `json:"shard,omitempty"`
ShardType string `json:"prirep,omitempty"`
State string `json:"state,omitempty"`
UnassignedReason string `json:"unassigned,omitempty"`
Docs string `json:"docs,omitempty"`
Store string `json:"store,omitempty"`
StoreInBytes int64 `json:"store_in_bytes,omitempty"`
NodeID string `json:"id,omitempty"`
NodeName string `json:"node,omitempty"`
NodeIP string `json:"ip,omitempty"`
}
{ "index" : ".monitoring-es-7-2020.12.29", "shard" : "0", "prirep" : "p", "state" : "STARTED", "unassigned.reason" : null, "docs" : "227608", "store" : "132.5mb", "id" : "qIgTsxtuQ8mzAGiBATkqHw", "node" : "dev", "ip" : "192.168.3.98" }
type ClusterHealth ¶
type ClusterHealth struct {
ResponseBase
Name string `json:"cluster_name"`
Status string `json:"status"`
TimedOut bool `json:"timed_out"`
NumberOfNodes int `json:"number_of_nodes"`
NumberOf_data_nodes int `json:"number_of_data_nodes"`
ActivePrimary_shards int `json:"active_primary_shards"`
ActiveShards int `json:"active_shards"`
RelocatingShards int `json:"relocating_shards"`
InitializingShards int `json:"initializing_shards"`
UnassignedShards int `json:"unassigned_shards"`
DelayedUnassignedShards int `json:"delayed_unassigned_shards"`
NumberOfPendingTasks int `json:"number_of_pending_tasks"`
NumberOfInFlightFetch int `json:"number_of_in_flight_fetch"`
TaskMaxWaitingInQueueMillis float64 `json:"task_max_waiting_in_queue_millis"`
ActiveShardsPercentAsNumber float64 `json:"active_shards_percent_as_number"`
Indices map[string]map[string]interface{} `json:"indices"`
}
type ClusterInformation ¶
type ClusterInformation struct {
Name string `json:"name,intern"`
ClusterName string `json:"cluster_name,intern"`
ClusterUUID string `json:"cluster_uuid"`
Version struct {
Number string `json:"number,intern"`
LuceneVersion string `json:"lucene_version,intern"`
Distribution string `json:"distribution"`
} `json:"version"`
}
type ClusterRoutingTable ¶
type ClusterRoutingTable struct {
Indices map[string]struct {
Shards map[string][]IndexShardRouting `json:"shards"`
} `json:"indices"`
}
type ClusterState ¶
type ClusterState struct {
ResponseBase
ClusterName string `json:"cluster_name"`
Version int64 `json:"version"`
StateUUID string `json:"state_uuid"`
ClusterUUID string `json:"cluster_uuid"`
MasterNode string `json:"master_node"`
//Nodes map[string]ClusterStateNodes `json:"nodes"`
RoutingTable *ClusterRoutingTable `json:"routing_table,omitempty"`
CompressedSizeInBytes int `json:"compressed_size_in_bytes"` //v6.0+
Metadata *struct {
Indices map[string]interface{} `json:"indices"`
} `json:"metadata,omitempty"`
}
type ClusterStateNodes ¶
type ClusterStats ¶
type CommandRequest ¶
type CommonCommand ¶
type CommonCommand struct {
ID string `json:"-" index:"id"`
Title string `json:"title" elastic_mapping:"title:{type:text,fields:{keyword:{type:keyword}}}"`
Tag []string `json:"tag" elastic_mapping:"tag:{type:keyword}"`
Requests []CommandRequest `json:"requests" elastic_mapping:"requests:{type:object}"`
Created time.Time `json:"created,omitempty" elastic_mapping:"created:{type:date}"`
}
type CountResponse ¶
type CountResponse struct {
ResponseBase
Count int64 `json:"count"`
}
CountResponse is a count response object
type DeleteByQueryResponse ¶
type DeleteResponse ¶
type DeleteResponse struct {
ResponseBase
Result string `json:"result"`
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Version int `json:"_version"`
Shards struct {
Total int `json:"total" `
Failed int `json:"failed"`
Successful int `json:"successful"`
} `json:"_shards"` //es 2.x index api
}
DeleteResponse is a delete response object
type DiscoveryResult ¶
type DiscoveryResult struct {
Nodes map[string]*LocalNodeInfo `json:"nodes,omitempty,nocopy"`
UnknownProcess []model.ProcessInfo `json:"unknown_process,omitempty,nocopy"`
}
type ElasticField ¶
type ElasticField struct {
Aggregatable bool `json:"aggregatable"`
ESTypes []string `json:"esTypes"`
Name string `json:"name"`
ReadFromDocValues bool `json:"readFromDocValues"`
Searchable bool `json:"searchable"`
Type string `json:"type"`
}
func GetFieldCaps ¶
func GetFieldCaps(client API, pattern string, metaFields []string) ([]ElasticField, error)
type ElasticFieldType ¶
type ElasticsearchConfig ¶
type ElasticsearchConfig struct {
orm.ORMObjectBase
Source string `json:"source,omitempty"`
Name string `json:"name,omitempty" config:"name" elastic_mapping:"name:{type:keyword,fields:{text: {type: text}}}"`
Description string `json:"description,omitempty" elastic_mapping:"description:{type:text}"`
//reserved means can't be deleted from console or API
Reserved bool `json:"reserved,omitempty" config:"reserved" elastic_mapping:"reserved:{type:boolean}"`
Enabled bool `json:"enabled,omitempty" config:"enabled" elastic_mapping:"enabled:{type:boolean}"`
Monitored bool `json:"monitored,omitempty" config:"monitored" elastic_mapping:"monitored:{type:boolean}"`
MonitorConfigs *MonitorConfig `config:"monitor_configs" json:"monitor_configs,omitempty" elastic_mapping:"monitor_configs:{type:object}"`
HttpProxy string `json:"http_proxy,omitempty" config:"http_proxy"`
Endpoint string `json:"endpoint,omitempty" config:"endpoint" elastic_mapping:"endpoint:{type:keyword}"`
Endpoints []string `json:"endpoints,omitempty" config:"endpoints" elastic_mapping:"endpoints:{type:keyword}"`
Version string `json:"version,omitempty" config:"version" elastic_mapping:"version:{type:keyword,copy_to:search_text}"`
ClientMode string `json:"client_mode,omitempty" config:"client_mode"`
RequestTimeout int `json:"request_timeout,omitempty" config:"request_timeout"`
RequestCompress bool `json:"request_compress,omitempty" config:"request_compress"`
MetadataCacheEnabled bool `json:"metadata_cache_enabled,omitempty" config:"metadata_cache_enabled"`
AllowAccessWhenMasterNotFound bool `json:"allow_access_when_master_not_found,omitempty" config:"allow_access_when_master_not_found"`
BasicAuth *model.BasicAuth `config:"basic_auth" json:"basic_auth,omitempty" elastic_mapping:"basic_auth:{type:object}"`
TrafficControl *struct {
Enabled bool `json:"enabled,omitempty" config:"enabled"`
MaxConnectionPerNode int `` /* 130-byte string literal not displayed */
MaxWaitTimeInMs int `json:"max_wait_time_in_ms,omitempty" config:"max_wait_time_in_ms" elastic_mapping:"max_wait_time_in_ms:{type:keyword}"`
MaxBytesPerNode int `json:"max_bytes_per_node,omitempty" config:"max_bytes_per_node" elastic_mapping:"max_bytes_per_node:{type:keyword}"`
MaxQpsPerNode int `json:"max_qps_per_node,omitempty" config:"max_qps_per_node" elastic_mapping:"max_qps_per_node:{type:keyword}"`
} `config:"traffic_control" json:"traffic_control,omitempty" elastic_mapping:"traffic_control:{type:object}"`
Discovery struct {
Enabled bool `json:"enabled,omitempty" config:"enabled"`
Modules []string `json:"module,omitempty" config:"module"`
Refresh struct {
Enabled bool `json:"enabled,omitempty" config:"enabled"`
Interval string `json:"interval,omitempty" config:"interval"`
} `json:"refresh,omitempty" config:"refresh"`
} `json:"discovery,omitempty" config:"discovery"`
Order int `json:"order,omitempty" elastic_mapping:"order:{type:integer}"`
Schema string `json:"schema,omitempty" elastic_mapping:"schema:{type:keyword}"`
Host string `json:"host,omitempty" elastic_mapping:"host:{type:keyword,copy_to:search_text}"`
Hosts []string `json:"hosts,omitempty" elastic_mapping:"hosts:{type:keyword}"`
GeoLocation *GeoLocation `json:"location,omitempty" elastic_mapping:"location:{type:object}"`
Project string `json:"project,omitempty" elastic_mapping:"project:{type:keyword,copy_to:search_text}"`
Owner []struct {
Department string `json:"department,omitempty" elastic_mapping:"department:{type:keyword,copy_to:search_text}"`
Name string `json:"name,omitempty" elastic_mapping:"name:{type:keyword,copy_to:search_text}"`
ID string `json:"id,omitempty" elastic_mapping:"id:{type:keyword}"`
} `json:"owner,omitempty" elastic_mapping:"owner:{type:object}"`
Labels util.MapStr `json:"labels,omitempty"`
Tags []string `json:"tags,omitempty" elastic_mapping:"tags:{type:keyword,copy_to:search_text}"`
SearchText string `` /* 138-byte string literal not displayed */
MaxCachedSize int64 `json:"max_cached_size,omitempty" elastic_mapping:"max_cached_size:{type:integer}"`
MetadataConfigs *MetadataConfig `config:"metadata_configs" json:"metadata_configs,omitempty" elastic_mapping:"metadata_configs:{type:object}"`
ClusterUUID string `json:"cluster_uuid,omitempty" elastic_mapping:"cluster_uuid:{type:keyword}"`
RawName string `json:"raw_name,omitempty" elastic_mapping:"raw_name:{type:keyword}"`
CredentialID string `json:"credential_id,omitempty" elastic_mapping:"credential_id:{type:keyword}"`
//TODO merge to cluster settings
AgentCredentialID string `json:"agent_credential_id,omitempty" elastic_mapping:"agent_credential_id:{type:keyword}"`
AgentBasicAuth *model.BasicAuth `config:"agent_basic_auth" json:"agent_basic_auth,omitempty" elastic_mapping:"agent_basic_auth:{type:object}"`
Distribution string `json:"distribution,omitempty" elastic_mapping:"distribution:{type:keyword}"`
NoDefaultAuthForAgent bool `json:"no_default_auth_for_agent,omitempty" config:"no_default_auth_for_agent"`
MetricCollectionMode string `json:"metric_collection_mode,omitempty" elastic_mapping:"metric_collection_mode:{type:keyword}"`
}
ElasticsearchConfig contains common settings for elasticsearch
func GetConfig ¶
func GetConfig(k string) *ElasticsearchConfig
func GetConfigNoPanic ¶
func GetConfigNoPanic(k string) *ElasticsearchConfig
func (*ElasticsearchConfig) GetAnyEndpoint ¶
func (c *ElasticsearchConfig) GetAnyEndpoint() string
func (*ElasticsearchConfig) ParseMajorVersion ¶
func (c *ElasticsearchConfig) ParseMajorVersion() int
type ElasticsearchMetadata ¶
type ElasticsearchMetadata struct {
Config *ElasticsearchConfig
ClusterState *ClusterState
NodesTopologyVersion int
Nodes *map[string]NodesInfo
IndexSettings map[string]*util.MapStr
//PrimaryShards *map[string]map[int]ShardInfo
Aliases *map[string]AliasInfo
Health *ClusterHealth
IsAgentMode bool
// contains filtered or unexported fields
}
func GetMetadata ¶
func GetMetadata(k string) *ElasticsearchMetadata
func GetOrInitMetadata ¶
func GetOrInitMetadata(cfg *ElasticsearchConfig) *ElasticsearchMetadata
func InitMetadata ¶
func InitMetadata(cfg *ElasticsearchConfig, defaultHealth bool) *ElasticsearchMetadata
* 初始化: ElasticsearchMetadata = ElasticsearchConfig + cache
并保存到metas(sync.Map)
func (*ElasticsearchMetadata) CheckNodeTrafficThrottle ¶
func (metadata *ElasticsearchMetadata) CheckNodeTrafficThrottle(node string, req, dataSize, maxWaitInMS int)
func (*ElasticsearchMetadata) GetActiveEndpoint ¶
func (meta *ElasticsearchMetadata) GetActiveEndpoint() string
func (*ElasticsearchMetadata) GetActiveHost ¶
func (meta *ElasticsearchMetadata) GetActiveHost() string
func (*ElasticsearchMetadata) GetActiveHosts ¶
func (meta *ElasticsearchMetadata) GetActiveHosts() int
func (*ElasticsearchMetadata) GetActivePreferredEndpoint ¶
func (meta *ElasticsearchMetadata) GetActivePreferredEndpoint(host string) string
func (*ElasticsearchMetadata) GetActivePreferredEndpoints ¶
func (meta *ElasticsearchMetadata) GetActivePreferredEndpoints(hosts []string) string
func (*ElasticsearchMetadata) GetActivePreferredHost ¶
func (metadata *ElasticsearchMetadata) GetActivePreferredHost(host string) string
func (*ElasticsearchMetadata) GetActivePreferredSeedEndpoint ¶
func (meta *ElasticsearchMetadata) GetActivePreferredSeedEndpoint() string
func (*ElasticsearchMetadata) GetActivePreferredSeedHost ¶
func (meta *ElasticsearchMetadata) GetActivePreferredSeedHost() string
func (*ElasticsearchMetadata) GetHttpClient ¶
func (metadata *ElasticsearchMetadata) GetHttpClient(host string) *fasthttp.Client
func (*ElasticsearchMetadata) GetIndexPrimaryShardRoutingTable ¶
func (metadata *ElasticsearchMetadata) GetIndexPrimaryShardRoutingTable(index string, shard int) (*IndexShardRouting, error)
func (*ElasticsearchMetadata) GetIndexPrimaryShardsRoutingTable ¶
func (metadata *ElasticsearchMetadata) GetIndexPrimaryShardsRoutingTable(index string) ([]IndexShardRouting, error)
func (*ElasticsearchMetadata) GetIndexRoutingTable ¶
func (metadata *ElasticsearchMetadata) GetIndexRoutingTable(index string) (map[string][]IndexShardRouting, error)
func (*ElasticsearchMetadata) GetIndexSetting ¶
func (*ElasticsearchMetadata) GetIndexStats ¶
func (metadata *ElasticsearchMetadata) GetIndexStats(indexName string) (*util.MapStr, error)
func (*ElasticsearchMetadata) GetMajorVersion ¶
func (meta *ElasticsearchMetadata) GetMajorVersion() int
func (*ElasticsearchMetadata) GetNodeInfo ¶
func (meta *ElasticsearchMetadata) GetNodeInfo(nodeID string) *NodesInfo
func (*ElasticsearchMetadata) GetPrimaryShardInfo ¶
func (meta *ElasticsearchMetadata) GetPrimaryShardInfo(index string, shardID string) (*IndexShardRouting, error)
func (*ElasticsearchMetadata) GetSchema ¶
func (meta *ElasticsearchMetadata) GetSchema() string
func (*ElasticsearchMetadata) GetSeedHosts ¶
func (meta *ElasticsearchMetadata) GetSeedHosts() []string
这是把所有有可能的地址,都获取一遍。
Config.Hosts / Config.Host 用户可能配置1个/多个host,都拿一遍
Config.Endpoint / Config.Endpoints 用户可能配置1个/多个Endpoint,都拿一遍
func (*ElasticsearchMetadata) GetValue ¶
func (metadata *ElasticsearchMetadata) GetValue(s string) (interface{}, error)
func (*ElasticsearchMetadata) Init ¶
func (meta *ElasticsearchMetadata) Init(health bool)
func (*ElasticsearchMetadata) IsAvailable ¶
func (meta *ElasticsearchMetadata) IsAvailable() bool
func (*ElasticsearchMetadata) IsTLS ¶
func (meta *ElasticsearchMetadata) IsTLS() bool
func (*ElasticsearchMetadata) LastSuccess ¶
func (metadata *ElasticsearchMetadata) LastSuccess() time.Time
func (*ElasticsearchMetadata) NewHttpClient ¶
func (metadata *ElasticsearchMetadata) NewHttpClient(host string) *fasthttp.Client
func (*ElasticsearchMetadata) PrepareEndpoint ¶
func (meta *ElasticsearchMetadata) PrepareEndpoint(host string) string
func (*ElasticsearchMetadata) ReportFailure ¶
func (meta *ElasticsearchMetadata) ReportFailure(errorMessage error) bool
func (*ElasticsearchMetadata) ReportSuccess ¶
func (meta *ElasticsearchMetadata) ReportSuccess()
type ErrorDetail ¶ added in v1.1.5
type ErrorResponse ¶
type EventAction ¶
type EventAction string
EventAction represents a metadata change operation
const ( EventActionCreate EventAction = "create" EventActionUpdate EventAction = "update" EventActionDelete EventAction = "delete" )
type FieldCapsResponse ¶
type GeoLocation ¶
type GeoLocation struct {
Provider string `json:"provider,omitempty" elastic_mapping:"provider:{type:keyword}"`
Region string `json:"region,omitempty" elastic_mapping:"region:{type:keyword}"`
DC string `json:"dc,omitempty" elastic_mapping:"dc:{type:keyword}"`
Rack string `json:"rack,omitempty" elastic_mapping:"rack:{type:keyword}"`
}
type GetResponse ¶
type GetResponse struct {
ResponseBase
Found bool `json:"found"`
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Version int `json:"_version"`
Source map[string]interface{} `json:"_source"`
}
GetResponse is a get response object
type HostMetadata ¶
type HostMetadata struct {
ID string `json:"id,omitempty" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
Timestamp time.Time `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"`
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
NodeID string `json:"node_id" elastic_mapping:"node_id:{type:keyword}"`
Metadata struct {
Host string `json:"host" elastic_mapping:"host:{type:keyword}"`
IPs []string `json:"ips" elastic_mapping:"ips:{type:keyword}"`
OS map[string]interface{} `json:"os" elastic_mapping:"os:{type:object,enabled:false}"`
} `json:"metadata" elastic_mapping:"metadata:{type:object}"`
}
type IndexConfig ¶
type IndexConfig struct {
ID string `json:"id,omitempty" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
Timestamp time.Time `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"`
Metadata IndexMetadata `json:"metadata"`
Fields util.MapStr `json:"payload" elastic_mapping:"payload:{type:object,enabled:false}"`
SearchText string `` /* 138-byte string literal not displayed */
}
type IndexDocument ¶
type IndexDocument struct {
Index string `json:"_index,omitempty"`
Type string `json:"_type,omitempty"`
ID string `json:"_id,omitempty"`
Routing string `json:"_routing,omitempty"`
Source map[string]interface{} `json:"_source,omitempty"`
Highlight map[string][]interface{} `json:"highlight,omitempty"`
}
IndexDocument used to construct indexing document
type IndexInfo ¶
type IndexInfo struct {
ID string `json:"id,omitempty"`
Index string `json:"index,omitempty"`
Status string `json:"status,omitempty"`
Health string `json:"health,omitempty"`
Shards int `json:"shards,omitempty"`
Replicas int `json:"replicas,omitempty"`
DocsCount int64 `json:"docs_count,omitempty"`
DocsDeleted int64 `json:"docs_deleted,omitempty"`
SegmentsCount int64 `json:"segments_count,omitempty"`
StoreSize string `json:"store_size,omitempty"`
PriStoreSize string `json:"pri_store_size,omitempty"`
}
type IndexLevelStats ¶
type IndexLevelStats struct {
Docs struct {
Count int `json:"count"`
Deleted int `json:"deleted"`
} `json:"docs"`
Store struct {
SizeInBytes int `json:"size_in_bytes"`
TotalDataSetSizeInBytes int `json:"total_data_set_size_in_bytes"`
ReservedInBytes int `json:"reserved_in_bytes"`
} `json:"store"`
Indexing struct {
IndexTotal int `json:"index_total"`
IndexTimeInMillis int `json:"index_time_in_millis"`
IndexCurrent int `json:"index_current"`
IndexFailed int `json:"index_failed"`
DeleteTotal int `json:"delete_total"`
DeleteTimeInMillis int `json:"delete_time_in_millis"`
DeleteCurrent int `json:"delete_current"`
NoopUpdateTotal int `json:"noop_update_total"`
IsThrottled bool `json:"is_throttled"`
ThrottleTimeInMillis int `json:"throttle_time_in_millis"`
} `json:"indexing"`
Get struct {
Total int `json:"total"`
TimeInMillis int `json:"time_in_millis"`
ExistsTotal int `json:"exists_total"`
ExistsTimeInMillis int `json:"exists_time_in_millis"`
MissingTotal int `json:"missing_total"`
MissingTimeInMillis int `json:"missing_time_in_millis"`
Current int `json:"current"`
} `json:"get"`
Search struct {
OpenContexts int `json:"open_contexts"`
QueryTotal int `json:"query_total"`
QueryTimeInMillis int `json:"query_time_in_millis"`
QueryCurrent int `json:"query_current"`
FetchTotal int `json:"fetch_total"`
FetchTimeInMillis int `json:"fetch_time_in_millis"`
FetchCurrent int `json:"fetch_current"`
ScrollTotal int `json:"scroll_total"`
ScrollTimeInMillis int `json:"scroll_time_in_millis"`
ScrollCurrent int `json:"scroll_current"`
SuggestTotal int `json:"suggest_total"`
SuggestTimeInMillis int `json:"suggest_time_in_millis"`
SuggestCurrent int `json:"suggest_current"`
} `json:"search"`
Merges struct {
Current int `json:"current"`
CurrentDocs int `json:"current_docs"`
CurrentSizeInBytes int `json:"current_size_in_bytes"`
Total int `json:"total"`
TotalTimeInMillis int `json:"total_time_in_millis"`
TotalDocs int `json:"total_docs"`
TotalSizeInBytes int `json:"total_size_in_bytes"`
TotalStoppedTimeInMillis int `json:"total_stopped_time_in_millis"`
TotalThrottledTimeInMillis int `json:"total_throttled_time_in_millis"`
TotalAutoThrottleInBytes int `json:"total_auto_throttle_in_bytes"`
} `json:"merges"`
Refresh struct {
Total int `json:"total"`
TotalTimeInMillis int `json:"total_time_in_millis"`
ExternalTotal int `json:"external_total"`
ExternalTotalTimeInMillis int `json:"external_total_time_in_millis"`
Listeners int `json:"listeners"`
} `json:"refresh"`
Flush struct {
Total int `json:"total"`
Periodic int `json:"periodic"`
TotalTimeInMillis int `json:"total_time_in_millis"`
} `json:"flush"`
Warmer struct {
Current int `json:"current"`
Total int `json:"total"`
TotalTimeInMillis int `json:"total_time_in_millis"`
} `json:"warmer"`
QueryCache struct {
MemorySizeInBytes int `json:"memory_size_in_bytes"`
TotalCount int `json:"total_count"`
HitCount int `json:"hit_count"`
MissCount int `json:"miss_count"`
CacheSize int `json:"cache_size"`
CacheCount int `json:"cache_count"`
Evictions int `json:"evictions"`
} `json:"query_cache"`
Fielddata struct {
MemorySizeInBytes int `json:"memory_size_in_bytes"`
Evictions int `json:"evictions"`
} `json:"fielddata"`
Completion struct {
SizeInBytes int `json:"size_in_bytes"`
} `json:"completion"`
Segments struct {
Count int `json:"count"`
MemoryInBytes int `json:"memory_in_bytes"`
TermsMemoryInBytes int `json:"terms_memory_in_bytes"`
StoredFieldsMemoryInBytes int `json:"stored_fields_memory_in_bytes"`
TermVectorsMemoryInBytes int `json:"term_vectors_memory_in_bytes"`
NormsMemoryInBytes int `json:"norms_memory_in_bytes"`
PointsMemoryInBytes int `json:"points_memory_in_bytes"`
DocValuesMemoryInBytes int `json:"doc_values_memory_in_bytes"`
IndexWriterMemoryInBytes int `json:"index_writer_memory_in_bytes"`
VersionMapMemoryInBytes int `json:"version_map_memory_in_bytes"`
FixedBitSetMemoryInBytes int `json:"fixed_bit_set_memory_in_bytes"`
MaxUnsafeAutoIdTimestamp int64 `json:"max_unsafe_auto_id_timestamp"`
FileSizes struct {
} `json:"file_sizes"`
} `json:"segments"`
Translog struct {
Operations int `json:"operations"`
SizeInBytes int `json:"size_in_bytes"`
UncommittedOperations int `json:"uncommitted_operations"`
UncommittedSizeInBytes int `json:"uncommitted_size_in_bytes"`
EarliestLastModifiedAge int `json:"earliest_last_modified_age"`
} `json:"translog"`
RequestCache struct {
MemorySizeInBytes int `json:"memory_size_in_bytes"`
Evictions int `json:"evictions"`
HitCount int `json:"hit_count"`
MissCount int `json:"miss_count"`
} `json:"request_cache"`
Recovery struct {
CurrentAsSource int `json:"current_as_source"`
CurrentAsTarget int `json:"current_as_target"`
ThrottleTimeInMillis int `json:"throttle_time_in_millis"`
} `json:"recovery"`
}
type IndexMetadata ¶
type IndexMetadata struct {
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
IndexID string `json:"index_id" elastic_mapping:"index_id:{type:keyword}"` //cluster_id:index_name (some metrics not return index uuid of lower es version )
IndexName string `json:"index_name" elastic_mapping:"index_name:{type:keyword,copy_to:search_text}"`
ClusterName string `json:"cluster_name" elastic_mapping:"cluster_name:{type:keyword,copy_to:search_text}"`
Labels util.MapStr `json:"labels,omitempty"`
Aliases interface{} `json:"aliases,omitempty" elastic_mapping:"aliases:{type:keyword,copy_to:search_text}"`
Category string `json:"category,omitempty"`
Tags []interface{} `json:"tags,omitempty" elastic_mapping:"tags:{type:keyword,copy_to:search_text}"`
}
type IndexShardRouting ¶
type IndexShardRouting struct {
State string `json:"state"`
Primary bool `json:"primary"`
Node string `json:"node"`
RelocatingNode interface{} `json:"relocating_node,omitempty"`
Shard int `json:"shard"`
Index string `json:"index"`
Version int `json:"version"` //< v5.0
//v5.0+ START
RecoverySource *struct {
Type string `json:"type"`
} `json:"recovery_source,omitempty"`
UnassignedInfo *struct {
Reason string `json:"reason"`
At time.Time `json:"at"`
Delayed bool `json:"delayed"`
AllocationStatus string `json:"allocation_status"`
} `json:"unassigned_info,omitempty"`
AllocationId *struct {
Id string `json:"id"`
} `json:"allocation_id,omitempty"`
}
type IndexStats ¶
type IndicesStats ¶
type IndicesStats struct {
ResponseBase
Nodes map[string]interface{} `json:"indices"`
}
type InsertResponse ¶
type InsertResponse struct {
ResponseBase
Result string `json:"result"`
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Version int `json:"_version"`
Shards struct {
Total int `json:"total" `
Failed int `json:"failed"`
Successful int `json:"successful"`
} `json:"_shards"` //es 2.x index api
}
InsertResponse is a index response object
type InternalError ¶ added in v1.1.5
type InternalError struct {
Error *ErrorDetail `json:"error,omitempty"`
Status int `json:"status,omitempty"`
}
type LocalNodeInfo ¶
type LocalNodeInfo struct {
Enrolled bool `json:"enrolled,omitempty,nocopy"` //whether this node is enrolled or not
ClusterID string `json:"cluster_id,omitempty,nocopy"` //infini system assigned cluster id
ClusterInfo *ClusterInformation `json:"cluster_info,omitempty,nocopy"`
NodeUUID string `json:"node_id,omitempty,nocopy"`
NodeInfo *NodesInfo `json:"node_info,omitempty,nocopy"`
Status string `json:"status,omitempty,nocopy"`
}
type MappingAPI ¶
type MatchQuery ¶
type MatchQuery struct {
Match map[string]interface{} `json:"match,omitempty"`
}
func (*MatchQuery) Set ¶
func (match *MatchQuery) Set(field string, v interface{})
Init match query's condition
type MetadataChangeEvent ¶
type MetadataChangeEvent func(meta, oldMeta *ElasticsearchMetadata, action EventAction)
MetadataChangeEvent represents a callback of metadata change
type MetadataConfig ¶
type MetadataConfig struct {
HealthCheck TaskConfig `json:"health_check"`
ClusterSettingsCheck TaskConfig `json:"cluster_settings_check"`
MetadataRefresh TaskConfig `json:"metadata_refresh"`
NodeAvailabilityCheck TaskConfig `json:"node_availability_check"`
}
type MonitorConfig ¶
type MonitorConfig struct {
ClusterHealth TaskConfig `json:"cluster_health"`
ClusterStats TaskConfig `json:"cluster_stats"`
NodeStats TaskConfig `json:"node_stats"`
IndexStats TaskConfig `json:"index_stats"`
}
type NodeAvailable ¶
type NodeAvailable struct {
ClusterID string //TODO should be removed
Host string
// contains filtered or unexported fields
}
func GetHostAvailableInfo ¶
func GetHostAvailableInfo(host string) (*NodeAvailable, bool)
func GetOrInitHost ¶
func GetOrInitHost(host string, clusterID string) *NodeAvailable
* 根据IP地址,返回可用的Node信息。 这里的Node并不包含es配置信息。 仅仅是集群的状态(是否可用)
如果根据IP从hosts(sync.Map)查询不到Node,则根据入参(host string,clusterID string)创建Node并保存
func (*NodeAvailable) FailureTickets ¶
func (node *NodeAvailable) FailureTickets() int
func (*NodeAvailable) IsAvailable ¶
func (node *NodeAvailable) IsAvailable() bool
func (*NodeAvailable) IsDead ¶
func (node *NodeAvailable) IsDead() bool
func (*NodeAvailable) LastCheck ¶
func (node *NodeAvailable) LastCheck() time.Time
func (*NodeAvailable) LastSuccess ¶
func (node *NodeAvailable) LastSuccess() time.Time
func (*NodeAvailable) ReportFailure ¶
func (node *NodeAvailable) ReportFailure()
func (*NodeAvailable) ReportSuccess ¶
func (node *NodeAvailable) ReportSuccess()
type NodeConfig ¶
type NodeConfig struct {
ID string `json:"id,omitempty" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
Timestamp time.Time `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"`
Metadata NodeMetadata `json:"metadata" elastic_mapping:"metadata: { type: object }"`
Payload NodePayload `json:"payload" elastic_mapping:"payload:{type:object,enabled:false}"`
SearchText string `` /* 138-byte string literal not displayed */
}
type NodeMetadata ¶
type NodeMetadata struct {
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
ClusterName string `json:"cluster_name" elastic_mapping:"cluster_name:{type:keyword,copy_to:search_text}"`
Host string `json:"host" elastic_mapping:"host:{type:keyword,copy_to:search_text}"`
NodeID string `json:"node_id" elastic_mapping:"node_id:{type:keyword}"`
NodeName string `json:"node_name" elastic_mapping:"node_name:{type:keyword,copy_to:search_text}"`
Tags []string `json:"tags,omitempty" elastic_mapping:"tags:{type:keyword,copy_to:search_text}"`
Labels util.MapStr `json:"labels,omitempty"`
Category string `json:"category,omitempty"`
}
type NodePayload ¶
type NodePayload struct {
NodeInfo *NodesInfo `json:"node_state,omitempty" elastic_mapping:"node_state:{type:object,enabled:false}"`
}
type NodesInfo ¶
type NodesInfo struct {
Name string `json:"name,omitempty,nocopy"`
Version string `json:"version,omitempty,nocopy"`
Http struct {
BoundAddress []string `json:"bound_address"`
PublishAddress string `json:"publish_address,omitempty"`
MaxContentLengthInBytes int64 `json:"max_content_length_in_bytes,omitempty"`
} `json:"http,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
Roles []string `json:"roles,omitempty"`
TransportAddress string `json:"transport_address"`
Host string `json:"host"`
Ip string `json:"ip"`
BuildFlavor string `json:"build_flavor"`
BuildType string `json:"build_type"`
BuildHash string `json:"build_hash"`
TotalIndexingBuffer int64 `json:"total_indexing_buffer,omitempty"`
Settings map[string]interface{} `json:"settings"`
Os map[string]interface{} `json:"os"`
Process struct {
RefreshIntervalInMillis int `json:"refresh_interval_in_millis"`
Id int `json:"id"`
Mlockall bool `json:"mlockall"`
} `json:"process"`
Jvm map[string]interface{} `json:"jvm"`
ThreadPool map[string]interface{} `json:"thread_pool"`
Transport struct {
BoundAddress []string `json:"bound_address"`
PublishAddress string `json:"publish_address"`
Profiles struct {
} `json:"profiles"`
} `json:"transport"`
Plugins []interface{} `json:"plugins"`
Modules []map[string]interface{} `json:"modules"`
Ingest map[string]interface{} `json:"ingest"`
Aggregations map[string]interface{} `json:"aggregations"`
}
func (*NodesInfo) GetHttpPublishHost ¶
func (*NodesInfo) GetPathLogs ¶
type NodesResponse ¶
type NodesStats ¶
type NodesStats struct {
ResponseBase
Nodes map[string]interface{} `json:"nodes"`
}
type PartitionInfo ¶
type PartitionInfo struct {
Key float64 `json:"key"`
Start float64 `json:"start"`
End float64 `json:"end"`
Filter map[string]interface{} `json:"filter"`
Docs int64 `json:"docs"`
Other bool
}
func GetPartitions ¶
func GetPartitions(q *PartitionQuery, client API) ([]PartitionInfo, error)
func MergePartitions ¶
func MergePartitions(sourcePartitions []PartitionInfo, targetPartitions []PartitionInfo, fieldName, fieldType string, filter interface{}) []PartitionInfo
NOTE: we assume GetPartitions returned sorted buckets from ES, if not, we need to manually sort source & target partitions by keys sourcePartitions & targetPartitions must've been generated with same bucket step & offset
type PartitionQuery ¶
type Query ¶
type Query struct {
BoolQuery *BoolQuery `json:"bool"`
}
Query is the root query object
type QueryStringQuery ¶
type QueryStringQuery struct {
Query map[string]interface{} `json:"query_string,omitempty"`
}
func NewQueryString ¶
func NewQueryString(q string) *QueryStringQuery
func (*QueryStringQuery) DefaultOperator ¶
func (query *QueryStringQuery) DefaultOperator(op string)
func (*QueryStringQuery) Fields ¶
func (query *QueryStringQuery) Fields(fields ...string)
func (*QueryStringQuery) QueryString ¶
func (query *QueryStringQuery) QueryString(q string)
type RangeQuery ¶
RangeQuery is used to find value in range
func (*RangeQuery) Gt ¶
func (query *RangeQuery) Gt(field string, value interface{})
func (*RangeQuery) Gte ¶
func (query *RangeQuery) Gte(field string, value interface{})
func (*RangeQuery) Lt ¶
func (query *RangeQuery) Lt(field string, value interface{})
func (*RangeQuery) Lte ¶
func (query *RangeQuery) Lte(field string, value interface{})
type ReindexResponse ¶
type ReindexResponse struct {
Task string `json:"task"`
}
type ReplicationAPI ¶
type ReplicationAPI interface {
StartReplication(followIndex string, body []byte) error
StopReplication(indexName string, body []byte) error
PauseReplication(followIndex string, body []byte) error
ResumeReplication(followIndex string, body []byte) error
GetReplicationStatus(followIndex string) ([]byte, error)
GetReplicationFollowerStats(followIndex string) ([]byte, error)
CreateAutoFollowReplication(autoFollowPatternName string, body []byte) error
GetAutoFollowStats(autoFollowPatternName string) ([]byte, error)
DeleteAutoFollowReplication(autoFollowPatternName string, body []byte) error
}
type ResponseBase ¶
type ResponseBase struct {
RawResult *util.Result `json:"-"`
StatusCode int `json:"-"`
ErrorObject error `json:"-"`
InternalError
}
func (*ResponseBase) GetBoolByJsonPath ¶
func (this *ResponseBase) GetBoolByJsonPath(path string) (interface{}, error)
func (*ResponseBase) GetBytesByJsonPath ¶
func (this *ResponseBase) GetBytesByJsonPath(path string) ([]byte, error)
func (*ResponseBase) GetIntByJsonPath ¶
func (this *ResponseBase) GetIntByJsonPath(path string) (interface{}, error)
func (*ResponseBase) GetStringByJsonPath ¶
func (this *ResponseBase) GetStringByJsonPath(path string) (interface{}, error)
type RetryRules ¶
type ScrollResponse ¶
type ScrollResponse struct {
Took int `json:"took,omitempty"`
ScrollId string `json:"_scroll_id,omitempty,nocopy"`
TimedOut bool `json:"timed_out,omitempty"`
Hits struct {
MaxScore float32 `json:"max_score,omitempty"`
Total int64 `json:"total,omitempty"`
Docs []IndexDocument `json:"hits,omitempty"`
} `json:"hits"`
Shards ShardResponse `json:"_shards,omitempty"`
}
func (*ScrollResponse) GetDocs ¶
func (scroll *ScrollResponse) GetDocs() []IndexDocument
func (*ScrollResponse) GetHitsTotal ¶
func (scroll *ScrollResponse) GetHitsTotal() int64
func (*ScrollResponse) GetScrollId ¶
func (scroll *ScrollResponse) GetScrollId() string
func (*ScrollResponse) GetShardResponse ¶
func (scroll *ScrollResponse) GetShardResponse() ShardResponse
func (ScrollResponse) MarshalEasyJSON ¶
func (v ScrollResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScrollResponse) MarshalJSON ¶
func (v ScrollResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ScrollResponse) SetScrollId ¶
func (scroll *ScrollResponse) SetScrollId(id string)
func (*ScrollResponse) UnmarshalEasyJSON ¶
func (v *ScrollResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScrollResponse) UnmarshalJSON ¶
func (v *ScrollResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type ScrollResponseAPI ¶
type ScrollResponseAPI interface {
GetScrollId() string
SetScrollId(id string)
GetHitsTotal() int64
GetShardResponse() ShardResponse
GetDocs() []IndexDocument
}
type ScrollResponseV7 ¶
type ScrollResponseV7 struct {
Took int `json:"took,omitempty"`
ScrollId string `json:"_scroll_id,omitempty,nocopy"`
TimedOut bool `json:"timed_out,omitempty"`
Hits struct {
MaxScore float32 `json:"max_score,omitempty"`
Total struct {
Value int64 `json:"value,omitempty"`
Relation string `json:"relation,omitempty"`
} `json:"total,omitempty"`
Docs []IndexDocument `json:"hits,omitempty"`
} `json:"hits"`
Shards ShardResponse `json:"_shards,omitempty"`
}
func (*ScrollResponseV7) GetDocs ¶
func (scroll *ScrollResponseV7) GetDocs() []IndexDocument
func (*ScrollResponseV7) GetHitsTotal ¶
func (scroll *ScrollResponseV7) GetHitsTotal() int64
func (*ScrollResponseV7) GetScrollId ¶
func (scroll *ScrollResponseV7) GetScrollId() string
func (*ScrollResponseV7) GetShardResponse ¶
func (scroll *ScrollResponseV7) GetShardResponse() ShardResponse
func (ScrollResponseV7) MarshalEasyJSON ¶
func (v ScrollResponseV7) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ScrollResponseV7) MarshalJSON ¶
func (v ScrollResponseV7) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ScrollResponseV7) SetScrollId ¶
func (scroll *ScrollResponseV7) SetScrollId(id string)
func (*ScrollResponseV7) UnmarshalEasyJSON ¶
func (v *ScrollResponseV7) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ScrollResponseV7) UnmarshalJSON ¶
func (v *ScrollResponseV7) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type SearchAggParam ¶
type SearchFilterParam ¶
type SearchHighlightParam ¶
type SearchRequest ¶
type SearchRequest struct {
Query *Query `json:"query,omitempty"`
From int `json:"from"`
Size int `json:"size"`
Collapse *Collapse `json:"collapse,omitempty"`
Sort *[]interface{} `json:"sort,omitempty"`
Source interface{} `json:"_source,omitempty"`
AggregationRequest *AggregationRequest `json:"aggs,omitempty"`
// contains filtered or unexported fields
}
SearchRequest is the root search query object
func GetSearchRequest ¶
func GetSearchRequest(querystring, dsl, sourceFields string, sortField, sortType string) *SearchRequest
func (*SearchRequest) AddSort ¶
func (request *SearchRequest) AddSort(field string, order string)
AddSort add sort conditions to SearchRequest
func (*SearchRequest) Set ¶
func (request *SearchRequest) Set(key string, value interface{}) error
func (*SearchRequest) ToJSONString ¶
func (request *SearchRequest) ToJSONString() string
type SearchResponse ¶
type SearchResponse struct {
ResponseBase
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Hits struct {
Total interface{} `json:"total"`
MaxScore float32 `json:"max_score"`
Hits []IndexDocument `json:"hits,omitempty"`
} `json:"hits"`
Aggregations map[string]AggregationResponse `json:"aggregations,omitempty"`
}
SearchResponse is a count response object
func (*SearchResponse) GetTotal ¶
func (response *SearchResponse) GetTotal() int64
type SearchTemplate ¶
type SearchTemplate struct {
ID string `json:"-" index:"id"`
Name string `json:"name" elastic_mapping:"name:{type:text}"`
Source string `json:"source" elastic_mapping:"source:{type:text}"`
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
Created time.Time `json:"created,omitempty" elastic_mapping:"created:{type:date}"`
Updated time.Time `json:"updated,omitempty" elastic_mapping:"updated:{type:date}"`
}
type SearchTemplateHistory ¶
type SearchTemplateHistory struct {
ID string `json:"-" index:"id"`
TemplateID string `json:"template_id" elastic_mapping:"template_id:{type:keyword}"`
Action string `json:"action" elastic_mapping:"action:{type:keyword}"`
Content map[string]interface{} `json:"content,omitempty" elastic_mapping:"content:{type:object}"`
Created time.Time `json:"created,omitempty" elastic_mapping:"created:{type:date}"`
}
type SecurityAPI ¶
type SecurityAPI interface {
GetUser(username string) ([]byte, error)
GetUsers() ([]byte, error)
DeleteUser(username string) error
PutUser(username string, body []byte) error
GetRole(roleName string) ([]byte, error)
GetRoles() ([]byte, error)
DeleteRole(roleName string) error
PutRole(roleName string, body []byte) error
GetPrivileges() ([]byte, error)
}
type Setting ¶
type Setting struct {
ID string `json:"-" index:"id"`
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
Key string `json:"key" elastic_mapping:"key:{type:keyword}"`
Value string `json:"value" elastic_mapping:"value:{type:keyword}"`
UpdatedAt time.Time `json:"updated_at,omitempty" elastic_mapping:"updated_at:{type:date}"`
}
type ShardInfo ¶
type ShardInfo struct {
Index string `json:"index,omitempty"`
ShardID string `json:"shard_id,omitempty"`
Primary bool `json:"primary,omitempty"`
State string `json:"state,omitempty"`
UnassignedReason string `json:"unassigned_reason,omitempty"`
Docs int64 `json:"docs_count,omitempty"`
Store string `json:"store_size,omitempty"`
NodeID string `json:"node_id,omitempty"`
NodeName string `json:"node_name,omitempty"`
NodeIP string `json:"node_ip,omitempty"`
}
type ShardResponse ¶
type ShardResponse struct {
Total int `json:"total,omitempty"`
Successful int `json:"successful,omitempty"`
Skipped int `json:"skipped,omitempty"`
Failed int `json:"failed,omitempty"`
Failures []struct {
Shard int `json:"shard,omitempty"`
Index string `json:"index,omitempty,intern"`
Status int `json:"status,omitempty"`
Reason json.RawMessage `json:"reason,omitempty,nocopy"`
} `json:"failures,omitempty"`
}
type Stats ¶
type Stats struct {
All struct {
Primaries IndexLevelStats `json:"primaries"`
Total IndexLevelStats `json:"total"`
} `json:"_all"`
Indices map[string]struct {
Uuid string `json:"uuid"` //v7.0+
Primaries IndexLevelStats `json:"primaries"`
Total IndexLevelStats `json:"total"`
} `json:"indices"`
}
type TaskConfig ¶
type TemplateAPI ¶
type TemplateAPI interface {
TemplateExists(scriptName string) (bool, error)
PutTemplate(scriptName string, template []byte) ([]byte, error)
GetTemplate(scriptName string) (map[string]interface{}, error)
SearchByTemplate(indexName, scriptName string, params map[string]interface{}) (*SearchResponse, error)
}
type TermsAggregationQuery ¶
type TermsAggregationQuery struct {
// contains filtered or unexported fields
}
func NewTermsAggregation ¶
func NewTermsAggregation() (query *TermsAggregationQuery)
func (*TermsAggregationQuery) Field ¶
func (query *TermsAggregationQuery) Field(field string) *TermsAggregationQuery
func (*TermsAggregationQuery) Size ¶
func (query *TermsAggregationQuery) Size(size int) *TermsAggregationQuery
type TermsQuery ¶
type TermsQuery struct {
Match map[string][]interface{} `json:"terms,omitempty"`
}
func (*TermsQuery) Set ¶
func (match *TermsQuery) Set(field string, v []interface{})
func (*TermsQuery) SetStringArray ¶
func (match *TermsQuery) SetStringArray(field string, v []string)
type TraceTemplate ¶
type TraceTemplate struct {
ID string `json:"-" index:"id"`
Name string `json:"name" elastic_mapping:"name:{type:text}"`
MetaIndex string `json:"meta_index" elastic_mapping:"meta_index:{type:keyword}"`
TraceField string `json:"trace_field" elastic_mapping:"trace_field:{type:keyword}"`
TimestampField string `json:"timestamp_field" elastic_mapping:"timestamp_field:{type:keyword}"`
AggField string `json:"agg_field" elastic_mapping:"agg_field:{type:keyword}"`
Description string `json:"description" elastic_mapping:"description:{type:text}"`
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
Created time.Time `json:"created,omitempty" elastic_mapping:"created:{type:date}"`
Updated time.Time `json:"updated,omitempty" elastic_mapping:"updated:{type:date}"`
}
type UpdateByQueryResponse ¶
type VersionInfo ¶
type VersionInfo struct {
Path string `json:"path"`
Index string `json:"_index"`
ID string `json:"_id"`
Version int64 `json:"_version"`
PrimaryTerm int64 `json:"_primary_term"`
SequenceNumber int64 `json:"_seq_no"`
Status int64 `json:"status"`
Payload [][]byte `json:"-"` //request
Time time.Time //Not record time, but local access time
DocOffset int `json:"doc_offset,omitempty"`
MessageOffset string `json:"msg_offset,omitempty"`
ThisMessageOffset queue.Offset `json:"this_msg_offset,omitempty"`
ReplicationID string `json:"replication_id,omitempty"`
MessageTime time.Time
}
func (*VersionInfo) GetKey ¶
func (ver *VersionInfo) GetKey() string
type View ¶
type View struct {
ID string `json:"-" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
ClusterID string `json:"cluster_id" elastic_mapping:"cluster_id:{type:keyword}"`
Title string `json:"title" elastic_mapping:"title:{type:keyword}"`
ViewName string `json:"viewName" elastic_mapping:"view_name:{type:text}`
TimeFieldName string `json:"timeFieldName" elastic_mapping:"timeFieldName:{type:keyword}"`
Fields string `json:"fields" elastic_mapping:"fields:{type:text}"`
FieldFormatMap string `json:"fieldFormatMap" elastic_mapping:"fields:{type:text}`
UpdatedAt time.Time `json:"updated_at,omitempty" elastic_mapping:"updated_at:{type:date}"`
DefaultLayoutID string `json:"default_layout_id" elastic_mapping:"default_layout_id:{type:keyword}"`
ComplexFields string `json:"complex_fields" elastic_mapping:"complex_fields:{type:text}"`
//determine if this view is built-in
Builtin bool `json:"builtin" elastic_mapping:"builtin:{type:boolean}"`
}
type ViewRequest ¶
type ViewRequest struct {
Attributes View `json:"attributes"`
}