[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
parent
834fc74873
commit
792b4dba2c
558 changed files with 32080 additions and 24669 deletions
5
vendor/github.com/olivere/elastic/v7/CONTRIBUTORS
generated
vendored
5
vendor/github.com/olivere/elastic/v7/CONTRIBUTORS
generated
vendored
|
@ -10,6 +10,7 @@
|
|||
Aaron Tami [@aarontami](https://github.com/aarontami)
|
||||
Adam Alix [@adamalix](https://github.com/adamalix)
|
||||
Adam Weiner [@adamweiner](https://github.com/adamweiner)
|
||||
Adam Szaraniec [@mimol91](https://github.com/mimol91)
|
||||
Adrian Lungu [@AdrianLungu](https://github.com/AdrianLungu)
|
||||
alehano [@alehano](https://github.com/alehano)
|
||||
Alejandro Carstens [@alejandro-carstens](https://github.com/alejandro-carstens)
|
||||
|
@ -66,6 +67,7 @@ David Emanuel Buchmann [@wuurrd](https://github.com/wuurrd)
|
|||
Devin Christensen [@quixoten](https://github.com/quixoten)
|
||||
diacone [@diacone](https://github.com/diacone)
|
||||
Diego Becciolini [@itizir](https://github.com/itizir)
|
||||
Don Smith III [@cactauz](https://github.com/cactauz)
|
||||
Dwayne Schultz [@myshkin5](https://github.com/myshkin5)
|
||||
Elizabeth Jarrett [@mejarrett](https://github.com/mejarrett)
|
||||
Elliot Williams [@elliotwms](https://github.com/elliotwms)
|
||||
|
@ -93,6 +95,7 @@ Haroldo Vélez [@Haroldov](https://github.com/Haroldov)
|
|||
Harrison Wright [@wright8191](https://github.com/wright8191)
|
||||
Henry Clifford [@hcliff](https://github.com/hcliff)
|
||||
Henry Stern [@hstern](https://github.com/hstern)
|
||||
Herbert Lu [@lryong](https://github.com/lryong)
|
||||
Igor Dubinskiy [@idubinskiy](https://github.com/idubinskiy)
|
||||
initialcontext [@initialcontext](https://github.com/initialcontext)
|
||||
Isaac Saldana [@isaldana](https://github.com/isaldana)
|
||||
|
@ -140,6 +143,7 @@ Martin Häger [@protomouse](https://github.com/protomouse)
|
|||
Matt Braymer-Hayes [@mattayes](https://github.com/mattayes)
|
||||
Medhi Bechina [@mdzor](https://github.com/mdzor)
|
||||
Mike Beshai [@mbesh](https://github.com/mbesh)
|
||||
Mikhail Balabin [@mablabin](https://github.com/mbalabin)
|
||||
mmfrb [@mmfrb](https://github.com/mmfrb)
|
||||
mnpritula [@mnpritula](https://github.com/mnpritula)
|
||||
mosa [@mosasiru](https://github.com/mosasiru)
|
||||
|
@ -164,6 +168,7 @@ Pete C [@peteclark-ft](https://github.com/peteclark-ft)
|
|||
Peter Nagy [@nagypeterjob](https://github.com/nagypeterjob)
|
||||
Paolo [@ppiccolo](https://github.com/ppiccolo)
|
||||
Phillip Baker [@phillbaker](https://github.com/phillbaker)
|
||||
QilingZhao [@qilingzhao](https://github.com/qilingzhao)
|
||||
Igor Panychek [@panychek](https://github.com/panychek)
|
||||
Radoslaw Wesolowski [@r--w](https://github.com/r--w)
|
||||
Rafał Gałus [@rgalus](https://github.com/rgalus)
|
||||
|
|
45
vendor/github.com/olivere/elastic/v7/README.md
generated
vendored
45
vendor/github.com/olivere/elastic/v7/README.md
generated
vendored
|
@ -178,59 +178,74 @@ Here are a few tips on how to get used to Elastic:
|
|||
|
||||
- Metrics Aggregations
|
||||
- [x] Avg
|
||||
- [ ] Boxplot (X-pack)
|
||||
- [x] Cardinality
|
||||
- [x] Extended Stats
|
||||
- [x] Geo Bounds
|
||||
- [x] Geo Centroid
|
||||
- [x] Matrix stats
|
||||
- [x] Max
|
||||
- [x] Median absolute deviation
|
||||
- [x] Min
|
||||
- [x] Percentiles
|
||||
- [x] Percentile Ranks
|
||||
- [x] Percentiles
|
||||
- [ ] Rate (X-pack)
|
||||
- [ ] Scripted Metric
|
||||
- [x] Stats
|
||||
- [ ] String stats (X-pack)
|
||||
- [x] Sum
|
||||
- [ ] T-test (X-pack)
|
||||
- [x] Top Hits
|
||||
- [ ] Top metrics (X-pack)
|
||||
- [x] Value Count
|
||||
- [x] Weighted avg
|
||||
- Bucket Aggregations
|
||||
- [x] Adjacency Matrix
|
||||
- [x] Children
|
||||
- [x] Auto-interval Date Histogram
|
||||
- [x] Children
|
||||
- [x] Composite
|
||||
- [x] Date Histogram
|
||||
- [x] Date Range
|
||||
- [x] Diversified Sampler
|
||||
- [x] Filter
|
||||
- [x] Filters
|
||||
- [x] Geo Distance
|
||||
- [ ] GeoHash Grid
|
||||
- [x] Geohash Grid
|
||||
- [x] Geotile grid
|
||||
- [x] Global
|
||||
- [x] Histogram
|
||||
- [x] IP Range
|
||||
- [x] Missing
|
||||
- [x] Nested
|
||||
- [ ] Parent
|
||||
- [x] Range
|
||||
- [ ] Rare terms
|
||||
- [x] Reverse Nested
|
||||
- [x] Sampler
|
||||
- [x] Significant Terms
|
||||
- [x] Significant Text
|
||||
- [x] Terms
|
||||
- [x] Composite
|
||||
- [ ] Variable width histogram
|
||||
- Pipeline Aggregations
|
||||
- [x] Avg Bucket
|
||||
- [x] Derivative
|
||||
- [x] Max Bucket
|
||||
- [x] Min Bucket
|
||||
- [x] Sum Bucket
|
||||
- [x] Stats Bucket
|
||||
- [ ] Extended Stats Bucket
|
||||
- [x] Percentiles Bucket
|
||||
- [x] Moving Average
|
||||
- [x] Cumulative Sum
|
||||
- [x] Bucket Script
|
||||
- [x] Bucket Selector
|
||||
- [x] Bucket Sort
|
||||
- [ ] Cumulative cardinality (X-pack)
|
||||
- [x] Cumulative Sum
|
||||
- [x] Derivative
|
||||
- [ ] Extended Stats Bucket
|
||||
- [ ] Inference bucket (X-pack)
|
||||
- [x] Max Bucket
|
||||
- [x] Min Bucket
|
||||
- [x] Moving Average
|
||||
- [x] Moving function
|
||||
- [ ] Moving percentiles (X-pack)
|
||||
- [ ] Normalize (X-pack)
|
||||
- [x] Percentiles Bucket
|
||||
- [x] Serial Differencing
|
||||
- [x] Matrix Aggregations
|
||||
- [x] Matrix Stats
|
||||
- [x] Stats Bucket
|
||||
- [x] Sum Bucket
|
||||
- [x] Aggregation Metadata
|
||||
|
||||
### Indices APIs
|
||||
|
|
250
vendor/github.com/olivere/elastic/v7/bulk_create_request.go
generated
vendored
Normal file
250
vendor/github.com/olivere/elastic/v7/bulk_create_request.go
generated
vendored
Normal file
|
@ -0,0 +1,250 @@
|
|||
// Copyright 2012-present Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
//go:generate easyjson bulk_create_request.go
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// BulkCreateRequest is a request to add a new document to Elasticsearch.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
|
||||
// for details.
|
||||
type BulkCreateRequest struct {
|
||||
BulkableRequest
|
||||
index string
|
||||
typ string
|
||||
id string
|
||||
opType string
|
||||
routing string
|
||||
parent string
|
||||
version *int64 // default is MATCH_ANY
|
||||
versionType string // default is "internal"
|
||||
doc interface{}
|
||||
pipeline string
|
||||
retryOnConflict *int
|
||||
ifSeqNo *int64
|
||||
ifPrimaryTerm *int64
|
||||
|
||||
source []string
|
||||
|
||||
useEasyJSON bool
|
||||
}
|
||||
|
||||
//easyjson:json
|
||||
type bulkCreateRequestCommand map[string]bulkCreateRequestCommandOp
|
||||
|
||||
//easyjson:json
|
||||
type bulkCreateRequestCommandOp struct {
|
||||
Index string `json:"_index,omitempty"`
|
||||
Id string `json:"_id,omitempty"`
|
||||
Type string `json:"_type,omitempty"`
|
||||
Parent string `json:"parent,omitempty"`
|
||||
// RetryOnConflict is "_retry_on_conflict" for 6.0 and "retry_on_conflict" for 6.1+.
|
||||
RetryOnConflict *int `json:"retry_on_conflict,omitempty"`
|
||||
Routing string `json:"routing,omitempty"`
|
||||
Version *int64 `json:"version,omitempty"`
|
||||
VersionType string `json:"version_type,omitempty"`
|
||||
Pipeline string `json:"pipeline,omitempty"`
|
||||
IfSeqNo *int64 `json:"if_seq_no,omitempty"`
|
||||
IfPrimaryTerm *int64 `json:"if_primary_term,omitempty"`
|
||||
}
|
||||
|
||||
// NewBulkCreateRequest returns a new BulkCreateRequest.
|
||||
// The operation type is "create" by default.
|
||||
func NewBulkCreateRequest() *BulkCreateRequest {
|
||||
return &BulkCreateRequest{
|
||||
opType: "create",
|
||||
}
|
||||
}
|
||||
|
||||
// UseEasyJSON is an experimental setting that enables serialization
|
||||
// with github.com/mailru/easyjson, which should in faster serialization
|
||||
// time and less allocations, but removed compatibility with encoding/json,
|
||||
// usage of unsafe etc. See https://github.com/mailru/easyjson#issues-notes-and-limitations
|
||||
// for details. This setting is disabled by default.
|
||||
func (r *BulkCreateRequest) UseEasyJSON(enable bool) *BulkCreateRequest {
|
||||
r.useEasyJSON = enable
|
||||
return r
|
||||
}
|
||||
|
||||
// Index specifies the Elasticsearch index to use for this create request.
|
||||
// If unspecified, the index set on the BulkService will be used.
|
||||
func (r *BulkCreateRequest) Index(index string) *BulkCreateRequest {
|
||||
r.index = index
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Type specifies the Elasticsearch type to use for this create request.
|
||||
// If unspecified, the type set on the BulkService will be used.
|
||||
func (r *BulkCreateRequest) Type(typ string) *BulkCreateRequest {
|
||||
r.typ = typ
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Id specifies the identifier of the document to create.
|
||||
func (r *BulkCreateRequest) Id(id string) *BulkCreateRequest {
|
||||
r.id = id
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Routing specifies a routing value for the request.
|
||||
func (r *BulkCreateRequest) Routing(routing string) *BulkCreateRequest {
|
||||
r.routing = routing
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Parent specifies the identifier of the parent document (if available).
|
||||
func (r *BulkCreateRequest) Parent(parent string) *BulkCreateRequest {
|
||||
r.parent = parent
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Version indicates the version of the document as part of an optimistic
|
||||
// concurrency model.
|
||||
func (r *BulkCreateRequest) Version(version int64) *BulkCreateRequest {
|
||||
v := version
|
||||
r.version = &v
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// VersionType specifies how versions are created. It can be e.g. internal,
|
||||
// external, external_gte, or force.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-index_.html#index-versioning
|
||||
// for details.
|
||||
func (r *BulkCreateRequest) VersionType(versionType string) *BulkCreateRequest {
|
||||
r.versionType = versionType
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Doc specifies the document to create.
|
||||
func (r *BulkCreateRequest) Doc(doc interface{}) *BulkCreateRequest {
|
||||
r.doc = doc
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// RetryOnConflict specifies how often to retry in case of a version conflict.
|
||||
func (r *BulkCreateRequest) RetryOnConflict(retryOnConflict int) *BulkCreateRequest {
|
||||
r.retryOnConflict = &retryOnConflict
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// Pipeline to use while processing the request.
|
||||
func (r *BulkCreateRequest) Pipeline(pipeline string) *BulkCreateRequest {
|
||||
r.pipeline = pipeline
|
||||
r.source = nil
|
||||
return r
|
||||
}
|
||||
|
||||
// IfSeqNo indicates to only perform the create operation if the last
|
||||
// operation that has changed the document has the specified sequence number.
|
||||
func (r *BulkCreateRequest) IfSeqNo(ifSeqNo int64) *BulkCreateRequest {
|
||||
r.ifSeqNo = &ifSeqNo
|
||||
return r
|
||||
}
|
||||
|
||||
// IfPrimaryTerm indicates to only perform the create operation if the
|
||||
// last operation that has changed the document has the specified primary term.
|
||||
func (r *BulkCreateRequest) IfPrimaryTerm(ifPrimaryTerm int64) *BulkCreateRequest {
|
||||
r.ifPrimaryTerm = &ifPrimaryTerm
|
||||
return r
|
||||
}
|
||||
|
||||
// String returns the on-wire representation of the create request,
|
||||
// concatenated as a single string.
|
||||
func (r *BulkCreateRequest) String() string {
|
||||
lines, err := r.Source()
|
||||
if err != nil {
|
||||
return fmt.Sprintf("error: %v", err)
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
|
||||
// Source returns the on-wire representation of the create request,
|
||||
// split into an action-and-meta-data line and an (optional) source line.
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
|
||||
// for details.
|
||||
func (r *BulkCreateRequest) Source() ([]string, error) {
|
||||
// { "create" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
|
||||
// { "field1" : "value1" }
|
||||
|
||||
if r.source != nil {
|
||||
return r.source, nil
|
||||
}
|
||||
|
||||
lines := make([]string, 2)
|
||||
|
||||
// "index" ...
|
||||
indexCommand := bulkCreateRequestCommandOp{
|
||||
Index: r.index,
|
||||
Type: r.typ,
|
||||
Id: r.id,
|
||||
Routing: r.routing,
|
||||
Parent: r.parent,
|
||||
Version: r.version,
|
||||
VersionType: r.versionType,
|
||||
RetryOnConflict: r.retryOnConflict,
|
||||
Pipeline: r.pipeline,
|
||||
IfSeqNo: r.ifSeqNo,
|
||||
IfPrimaryTerm: r.ifPrimaryTerm,
|
||||
}
|
||||
command := bulkCreateRequestCommand{
|
||||
r.opType: indexCommand,
|
||||
}
|
||||
|
||||
var err error
|
||||
var body []byte
|
||||
if r.useEasyJSON {
|
||||
// easyjson
|
||||
body, err = command.MarshalJSON()
|
||||
} else {
|
||||
// encoding/json
|
||||
body, err = json.Marshal(command)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lines[0] = string(body)
|
||||
|
||||
// "field1" ...
|
||||
if r.doc != nil {
|
||||
switch t := r.doc.(type) {
|
||||
default:
|
||||
body, err := json.Marshal(r.doc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
lines[1] = string(body)
|
||||
case json.RawMessage:
|
||||
lines[1] = string(t)
|
||||
case *json.RawMessage:
|
||||
lines[1] = string(*t)
|
||||
case string:
|
||||
lines[1] = t
|
||||
case *string:
|
||||
lines[1] = *t
|
||||
}
|
||||
} else {
|
||||
lines[1] = "{}"
|
||||
}
|
||||
|
||||
r.source = lines
|
||||
return lines, nil
|
||||
}
|
302
vendor/github.com/olivere/elastic/v7/bulk_create_request_easyjson.go
generated
vendored
Normal file
302
vendor/github.com/olivere/elastic/v7/bulk_create_request_easyjson.go
generated
vendored
Normal file
|
@ -0,0 +1,302 @@
|
|||
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
|
||||
|
||||
package elastic
|
||||
|
||||
import (
|
||||
json "encoding/json"
|
||||
easyjson "github.com/mailru/easyjson"
|
||||
jlexer "github.com/mailru/easyjson/jlexer"
|
||||
jwriter "github.com/mailru/easyjson/jwriter"
|
||||
)
|
||||
|
||||
// suppress unused package warning
|
||||
var (
|
||||
_ *json.RawMessage
|
||||
_ *jlexer.Lexer
|
||||
_ *jwriter.Writer
|
||||
_ easyjson.Marshaler
|
||||
)
|
||||
|
||||
func easyjson29a8ef77DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulkCreateRequestCommandOp) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
in.Skip()
|
||||
return
|
||||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
in.WantComma()
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "_index":
|
||||
out.Index = string(in.String())
|
||||
case "_id":
|
||||
out.Id = string(in.String())
|
||||
case "_type":
|
||||
out.Type = string(in.String())
|
||||
case "parent":
|
||||
out.Parent = string(in.String())
|
||||
case "retry_on_conflict":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.RetryOnConflict = nil
|
||||
} else {
|
||||
if out.RetryOnConflict == nil {
|
||||
out.RetryOnConflict = new(int)
|
||||
}
|
||||
*out.RetryOnConflict = int(in.Int())
|
||||
}
|
||||
case "routing":
|
||||
out.Routing = string(in.String())
|
||||
case "version":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.Version = nil
|
||||
} else {
|
||||
if out.Version == nil {
|
||||
out.Version = new(int64)
|
||||
}
|
||||
*out.Version = int64(in.Int64())
|
||||
}
|
||||
case "version_type":
|
||||
out.VersionType = string(in.String())
|
||||
case "pipeline":
|
||||
out.Pipeline = string(in.String())
|
||||
case "if_seq_no":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.IfSeqNo = nil
|
||||
} else {
|
||||
if out.IfSeqNo == nil {
|
||||
out.IfSeqNo = new(int64)
|
||||
}
|
||||
*out.IfSeqNo = int64(in.Int64())
|
||||
}
|
||||
case "if_primary_term":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.IfPrimaryTerm = nil
|
||||
} else {
|
||||
if out.IfPrimaryTerm == nil {
|
||||
out.IfPrimaryTerm = new(int64)
|
||||
}
|
||||
*out.IfPrimaryTerm = int64(in.Int64())
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjson29a8ef77EncodeGithubComOlivereElasticV7(out *jwriter.Writer, in bulkCreateRequestCommandOp) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
if in.Index != "" {
|
||||
const prefix string = ",\"_index\":"
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
out.String(string(in.Index))
|
||||
}
|
||||
if in.Id != "" {
|
||||
const prefix string = ",\"_id\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Id))
|
||||
}
|
||||
if in.Type != "" {
|
||||
const prefix string = ",\"_type\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Type))
|
||||
}
|
||||
if in.Parent != "" {
|
||||
const prefix string = ",\"parent\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Parent))
|
||||
}
|
||||
if in.RetryOnConflict != nil {
|
||||
const prefix string = ",\"retry_on_conflict\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.Int(int(*in.RetryOnConflict))
|
||||
}
|
||||
if in.Routing != "" {
|
||||
const prefix string = ",\"routing\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Routing))
|
||||
}
|
||||
if in.Version != nil {
|
||||
const prefix string = ",\"version\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.Int64(int64(*in.Version))
|
||||
}
|
||||
if in.VersionType != "" {
|
||||
const prefix string = ",\"version_type\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.VersionType))
|
||||
}
|
||||
if in.Pipeline != "" {
|
||||
const prefix string = ",\"pipeline\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Pipeline))
|
||||
}
|
||||
if in.IfSeqNo != nil {
|
||||
const prefix string = ",\"if_seq_no\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.Int64(int64(*in.IfSeqNo))
|
||||
}
|
||||
if in.IfPrimaryTerm != nil {
|
||||
const prefix string = ",\"if_primary_term\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.Int64(int64(*in.IfPrimaryTerm))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v bulkCreateRequestCommandOp) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjson29a8ef77EncodeGithubComOlivereElasticV7(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v bulkCreateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjson29a8ef77EncodeGithubComOlivereElasticV7(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *bulkCreateRequestCommandOp) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjson29a8ef77DecodeGithubComOlivereElasticV7(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *bulkCreateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjson29a8ef77DecodeGithubComOlivereElasticV7(l, v)
|
||||
}
|
||||
func easyjson29a8ef77DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, out *bulkCreateRequestCommand) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
} else {
|
||||
in.Delim('{')
|
||||
*out = make(bulkCreateRequestCommand)
|
||||
for !in.IsDelim('}') {
|
||||
key := string(in.String())
|
||||
in.WantColon()
|
||||
var v1 bulkCreateRequestCommandOp
|
||||
(v1).UnmarshalEasyJSON(in)
|
||||
(*out)[key] = v1
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
}
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjson29a8ef77EncodeGithubComOlivereElasticV71(out *jwriter.Writer, in bulkCreateRequestCommand) {
|
||||
if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
|
||||
out.RawString(`null`)
|
||||
} else {
|
||||
out.RawByte('{')
|
||||
v2First := true
|
||||
for v2Name, v2Value := range in {
|
||||
if v2First {
|
||||
v2First = false
|
||||
} else {
|
||||
out.RawByte(',')
|
||||
}
|
||||
out.String(string(v2Name))
|
||||
out.RawByte(':')
|
||||
(v2Value).MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v bulkCreateRequestCommand) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjson29a8ef77EncodeGithubComOlivereElasticV71(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v bulkCreateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjson29a8ef77EncodeGithubComOlivereElasticV71(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *bulkCreateRequestCommand) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjson29a8ef77DecodeGithubComOlivereElasticV71(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *bulkCreateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjson29a8ef77DecodeGithubComOlivereElasticV71(l, v)
|
||||
}
|
2
vendor/github.com/olivere/elastic/v7/bulk_delete_request_easyjson.go
generated
vendored
2
vendor/github.com/olivere/elastic/v7/bulk_delete_request_easyjson.go
generated
vendored
|
@ -28,7 +28,7 @@ func easyjson8092efb6DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulk
|
|||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
|
|
2
vendor/github.com/olivere/elastic/v7/bulk_index_request.go
generated
vendored
2
vendor/github.com/olivere/elastic/v7/bulk_index_request.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// BulkIndexRequest is a request to add a document to Elasticsearch.
|
||||
// BulkIndexRequest is a request to add or replace a document to Elasticsearch.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-bulk.html
|
||||
// for details.
|
||||
|
|
2
vendor/github.com/olivere/elastic/v7/bulk_index_request_easyjson.go
generated
vendored
2
vendor/github.com/olivere/elastic/v7/bulk_index_request_easyjson.go
generated
vendored
|
@ -28,7 +28,7 @@ func easyjson9de0fcbfDecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulk
|
|||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
|
|
4
vendor/github.com/olivere/elastic/v7/bulk_update_request_easyjson.go
generated
vendored
4
vendor/github.com/olivere/elastic/v7/bulk_update_request_easyjson.go
generated
vendored
|
@ -28,7 +28,7 @@ func easyjson1ed00e60DecodeGithubComOlivereElasticV7(in *jlexer.Lexer, out *bulk
|
|||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
|
@ -227,7 +227,7 @@ func easyjson1ed00e60DecodeGithubComOlivereElasticV71(in *jlexer.Lexer, out *bul
|
|||
}
|
||||
in.Delim('{')
|
||||
for !in.IsDelim('}') {
|
||||
key := in.UnsafeString()
|
||||
key := in.UnsafeFieldName(false)
|
||||
in.WantColon()
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
|
|
211
vendor/github.com/olivere/elastic/v7/cat_fielddata.go
generated
vendored
Normal file
211
vendor/github.com/olivere/elastic/v7/cat_fielddata.go
generated
vendored
Normal file
|
@ -0,0 +1,211 @@
|
|||
// Copyright 2012-present Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/olivere/elastic/v7/uritemplates"
|
||||
)
|
||||
|
||||
// CatFielddataService Returns the amount of heap memory currently used by
|
||||
// the field data cache on every data node in the cluster.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.12/cat-fielddata.html
|
||||
// for details.
|
||||
type CatFielddataService struct {
|
||||
client *Client
|
||||
|
||||
pretty *bool // pretty format the returned JSON response
|
||||
human *bool // return human readable values for statistics
|
||||
errorTrace *bool // include the stack trace of returned errors
|
||||
filterPath []string // list of filters used to reduce the response
|
||||
headers http.Header // custom request-level HTTP headers
|
||||
|
||||
fields []string // list of fields used to limit returned information
|
||||
bytes string // b, k, m, or g
|
||||
columns []string
|
||||
sort []string // list of columns for sort order
|
||||
}
|
||||
|
||||
// NewCatFielddataService creates a new NewCatFielddataService.
|
||||
func NewCatFielddataService(client *Client) *CatFielddataService {
|
||||
return &CatFielddataService{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// Pretty tells Elasticsearch whether to return a formatted JSON response.
|
||||
func (s *CatFielddataService) Pretty(pretty bool) *CatFielddataService {
|
||||
s.pretty = &pretty
|
||||
return s
|
||||
}
|
||||
|
||||
// Human specifies whether human readable values should be returned in
|
||||
// the JSON response, e.g. "7.5mb".
|
||||
func (s *CatFielddataService) Human(human bool) *CatFielddataService {
|
||||
s.human = &human
|
||||
return s
|
||||
}
|
||||
|
||||
// ErrorTrace specifies whether to include the stack trace of returned errors.
|
||||
func (s *CatFielddataService) ErrorTrace(errorTrace bool) *CatFielddataService {
|
||||
s.errorTrace = &errorTrace
|
||||
return s
|
||||
}
|
||||
|
||||
// FilterPath specifies a list of filters used to reduce the response.
|
||||
func (s *CatFielddataService) FilterPath(filterPath ...string) *CatFielddataService {
|
||||
s.filterPath = filterPath
|
||||
return s
|
||||
}
|
||||
|
||||
// Header adds a header to the request.
|
||||
func (s *CatFielddataService) Header(name string, value string) *CatFielddataService {
|
||||
if s.headers == nil {
|
||||
s.headers = http.Header{}
|
||||
}
|
||||
s.headers.Add(name, value)
|
||||
return s
|
||||
}
|
||||
|
||||
// Headers specifies the headers of the request.
|
||||
func (s *CatFielddataService) Headers(headers http.Header) *CatFielddataService {
|
||||
s.headers = headers
|
||||
return s
|
||||
}
|
||||
|
||||
// Fielddata specifies one or more node IDs to for information should be returned.
|
||||
func (s *CatFielddataService) Field(fields ...string) *CatFielddataService {
|
||||
s.fields = fields
|
||||
return s
|
||||
}
|
||||
|
||||
// Bytes represents the unit in which to display byte values.
|
||||
// Valid values are: "b", "k", "m", or "g".
|
||||
func (s *CatFielddataService) Bytes(bytes string) *CatFielddataService {
|
||||
s.bytes = bytes
|
||||
return s
|
||||
}
|
||||
|
||||
// Columns to return in the response.
|
||||
// To get a list of all possible columns to return, run the following command
|
||||
// in your terminal:
|
||||
//
|
||||
// Example:
|
||||
// curl 'http://localhost:9200/_cat/fielddata?help'
|
||||
//
|
||||
// You can use Columns("*") to return all possible columns. That might take
|
||||
// a little longer than the default set of columns.
|
||||
func (s *CatFielddataService) Columns(columns ...string) *CatFielddataService {
|
||||
s.columns = columns
|
||||
return s
|
||||
}
|
||||
|
||||
// Sort is a list of fields to sort by.
|
||||
func (s *CatFielddataService) Sort(fields ...string) *CatFielddataService {
|
||||
s.sort = fields
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *CatFielddataService) buildURL() (string, url.Values, error) {
|
||||
// Build URL
|
||||
var (
|
||||
path string
|
||||
err error
|
||||
)
|
||||
|
||||
if len(s.fields) > 0 {
|
||||
path, err = uritemplates.Expand("/_cat/fielddata/{field}", map[string]string{
|
||||
"field": strings.Join(s.fields, ","),
|
||||
})
|
||||
} else {
|
||||
path = "/_cat/fielddata/"
|
||||
}
|
||||
if err != nil {
|
||||
return "", url.Values{}, err
|
||||
}
|
||||
|
||||
// Add query string parameters
|
||||
params := url.Values{
|
||||
"format": []string{"json"}, // always returns as JSON
|
||||
}
|
||||
if v := s.pretty; v != nil {
|
||||
params.Set("pretty", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.human; v != nil {
|
||||
params.Set("human", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.errorTrace; v != nil {
|
||||
params.Set("error_trace", fmt.Sprint(*v))
|
||||
}
|
||||
if len(s.filterPath) > 0 {
|
||||
params.Set("filter_path", strings.Join(s.filterPath, ","))
|
||||
}
|
||||
if s.bytes != "" {
|
||||
params.Set("bytes", s.bytes)
|
||||
}
|
||||
if len(s.sort) > 0 {
|
||||
params.Set("s", strings.Join(s.sort, ","))
|
||||
}
|
||||
if len(s.columns) > 0 {
|
||||
params.Set("h", strings.Join(s.columns, ","))
|
||||
}
|
||||
return path, params, nil
|
||||
}
|
||||
|
||||
// Do executes the operation.
|
||||
func (s *CatFielddataService) Do(ctx context.Context) (CatFielddataResponse, error) {
|
||||
// Get URL for request
|
||||
path, params, err := s.buildURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get HTTP response
|
||||
res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
|
||||
Method: "GET",
|
||||
Path: path,
|
||||
Params: params,
|
||||
Headers: s.headers,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Return operation response
|
||||
var ret CatFielddataResponse
|
||||
if err := s.client.decoder.Decode(res.Body, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// -- Result of a get request.
|
||||
|
||||
// CatFielddataResponse is the outcome of CatFielddataService.Do.
|
||||
type CatFielddataResponse []CatFielddataResponseRow
|
||||
|
||||
// CatFielddataResponseRow is a single row in a CatFielddataResponse.
|
||||
// Notice that not all of these fields might be filled; that depends on
|
||||
// the number of columns chose in the request (see CatFielddataService.Columns).
|
||||
type CatFielddataResponseRow struct {
|
||||
// Id represents the id of the fielddata.
|
||||
Id string `json:"id"`
|
||||
// Host represents the hostname of the fielddata.
|
||||
Host string `json:"host"`
|
||||
// IP represents the IP address of the fielddata.
|
||||
IP string `json:"ip"`
|
||||
// Node represents the Node name of the fielddata.
|
||||
Node string `json:"node"`
|
||||
// Field represents the name of the fielddata.
|
||||
Field string `json:"field"`
|
||||
// Size represents the size of the fielddata, e.g. "53.2gb".
|
||||
Size string `json:"size"`
|
||||
}
|
50
vendor/github.com/olivere/elastic/v7/client.go
generated
vendored
50
vendor/github.com/olivere/elastic/v7/client.go
generated
vendored
|
@ -14,6 +14,7 @@ import (
|
|||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -25,7 +26,7 @@ import (
|
|||
|
||||
const (
|
||||
// Version is the current version of Elastic.
|
||||
Version = "7.0.22"
|
||||
Version = "7.0.24"
|
||||
|
||||
// DefaultURL is the default endpoint of Elasticsearch on the local machine.
|
||||
// It is used e.g. when initializing a new Client without a specific URL.
|
||||
|
@ -983,6 +984,10 @@ func (c *Client) sniffNode(ctx context.Context, url string) []*conn {
|
|||
}
|
||||
c.mu.RUnlock()
|
||||
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req.Header.Add("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
|
||||
}
|
||||
|
||||
res, err := c.c.Do((*http.Request)(req).WithContext(ctx))
|
||||
if err != nil {
|
||||
return nodes
|
||||
|
@ -1126,6 +1131,9 @@ func (c *Client) healthcheck(parentCtx context.Context, timeout time.Duration, f
|
|||
}
|
||||
}
|
||||
}
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req.Header.Add("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
|
||||
}
|
||||
res, err := c.c.Do((*http.Request)(req).WithContext(ctx))
|
||||
if res != nil {
|
||||
status = res.StatusCode
|
||||
|
@ -1286,6 +1294,7 @@ type PerformRequestOptions struct {
|
|||
RetryStatusCodes []int
|
||||
Headers http.Header
|
||||
MaxResponseSize int64
|
||||
Stream bool
|
||||
}
|
||||
|
||||
// PerformRequest does a HTTP request to Elasticsearch.
|
||||
|
@ -1294,6 +1303,9 @@ type PerformRequestOptions struct {
|
|||
// Optionally, a list of HTTP error codes to ignore can be passed.
|
||||
// This is necessary for services that expect e.g. HTTP status 404 as a
|
||||
// valid outcome (Exists, IndicesExists, IndicesTypeExists).
|
||||
//
|
||||
// If Stream is set, the returned BodyReader field must be closed, even
|
||||
// if PerformRequest returns an error.
|
||||
func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions) (*Response, error) {
|
||||
start := time.Now().UTC()
|
||||
|
||||
|
@ -1383,11 +1395,9 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
|
|||
if opt.ContentType != "" {
|
||||
req.Header.Set("Content-Type", opt.ContentType)
|
||||
}
|
||||
if len(opt.Headers) > 0 {
|
||||
for key, value := range opt.Headers {
|
||||
for _, v := range value {
|
||||
req.Header.Add(key, v)
|
||||
}
|
||||
for key, value := range opt.Headers {
|
||||
for _, v := range value {
|
||||
req.Header.Add(key, v)
|
||||
}
|
||||
}
|
||||
if len(defaultHeaders) > 0 {
|
||||
|
@ -1397,6 +1407,9 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
|
|||
}
|
||||
}
|
||||
}
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req.Header.Set("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
|
||||
}
|
||||
|
||||
// Set body
|
||||
if opt.Body != nil {
|
||||
|
@ -1448,7 +1461,10 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
|
|||
continue // try again
|
||||
}
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
if !opt.Stream {
|
||||
defer res.Body.Close()
|
||||
}
|
||||
|
||||
// Tracing
|
||||
c.dumpResponse(res)
|
||||
|
@ -1465,14 +1481,14 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
|
|||
if err := checkResponse((*http.Request)(req), res, opt.IgnoreErrors...); err != nil {
|
||||
// No retry if request succeeded
|
||||
// We still try to return a response.
|
||||
resp, _ = c.newResponse(res, opt.MaxResponseSize)
|
||||
resp, _ = c.newResponse(res, opt.MaxResponseSize, opt.Stream)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// We successfully made a request with this connection
|
||||
conn.MarkAsHealthy()
|
||||
|
||||
resp, err = c.newResponse(res, opt.MaxResponseSize)
|
||||
resp, err = c.newResponse(res, opt.MaxResponseSize, opt.Stream)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1620,6 +1636,16 @@ func (c *Client) ClearScroll(scrollIds ...string) *ClearScrollService {
|
|||
return NewClearScrollService(c).ScrollId(scrollIds...)
|
||||
}
|
||||
|
||||
// OpenPointInTime opens a new Point in Time.
|
||||
func (c *Client) OpenPointInTime(indices ...string) *OpenPointInTimeService {
|
||||
return NewOpenPointInTimeService(c).Index(indices...)
|
||||
}
|
||||
|
||||
// ClosePointInTime closes an existing Point in Time.
|
||||
func (c *Client) ClosePointInTime(id string) *ClosePointInTimeService {
|
||||
return NewClosePointInTimeService(c).ID(id)
|
||||
}
|
||||
|
||||
// -- Indices APIs --
|
||||
|
||||
// CreateIndex returns a service to create a new index.
|
||||
|
@ -1835,7 +1861,6 @@ func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService {
|
|||
|
||||
// -- cat APIs --
|
||||
|
||||
// TODO cat fielddata
|
||||
// TODO cat master
|
||||
// TODO cat nodes
|
||||
// TODO cat pending tasks
|
||||
|
@ -1845,6 +1870,11 @@ func (c *Client) GetFieldMapping() *IndicesGetFieldMappingService {
|
|||
// TODO cat shards
|
||||
// TODO cat segments
|
||||
|
||||
// CatFielddata returns information about the amount of heap memory currently used by the field data cache.
|
||||
func (c *Client) CatFielddata() *CatFielddataService {
|
||||
return NewCatFielddataService(c)
|
||||
}
|
||||
|
||||
// CatAliases returns information about aliases.
|
||||
func (c *Client) CatAliases() *CatAliasesService {
|
||||
return NewCatAliasesService(c)
|
||||
|
|
4
vendor/github.com/olivere/elastic/v7/docker-compose.yml
generated
vendored
4
vendor/github.com/olivere/elastic/v7/docker-compose.yml
generated
vendored
|
@ -2,7 +2,7 @@ version: '3'
|
|||
|
||||
services:
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.9.3
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
|
||||
hostname: elasticsearch
|
||||
environment:
|
||||
- cluster.name=elasticsearch
|
||||
|
@ -28,7 +28,7 @@ services:
|
|||
ports:
|
||||
- 9200:9200
|
||||
platinum:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
|
||||
hostname: elasticsearch-platinum
|
||||
environment:
|
||||
- cluster.name=platinum
|
||||
|
|
9
vendor/github.com/olivere/elastic/v7/go.mod
generated
vendored
9
vendor/github.com/olivere/elastic/v7/go.mod
generated
vendored
|
@ -3,16 +3,15 @@ module github.com/olivere/elastic/v7
|
|||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go v1.35.20
|
||||
github.com/aws/aws-sdk-go v1.38.3
|
||||
github.com/fortytw2/leaktest v1.3.0
|
||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||
github.com/google/go-cmp v0.5.2
|
||||
github.com/mailru/easyjson v0.7.6
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/mailru/easyjson v0.7.7
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/smartystreets/assertions v1.1.1 // indirect
|
||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9
|
||||
github.com/smartystreets/gunit v1.4.2 // indirect
|
||||
github.com/stretchr/testify v1.5.1 // indirect
|
||||
go.opencensus.io v0.22.5
|
||||
go.opencensus.io v0.23.0
|
||||
)
|
||||
|
|
13
vendor/github.com/olivere/elastic/v7/ping.go
generated
vendored
13
vendor/github.com/olivere/elastic/v7/ping.go
generated
vendored
|
@ -10,6 +10,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -160,11 +161,9 @@ func (s *PingService) Do(ctx context.Context) (*PingResult, int, error) {
|
|||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
if len(s.headers) > 0 {
|
||||
for key, values := range s.headers {
|
||||
for _, v := range values {
|
||||
req.Header.Add(key, v)
|
||||
}
|
||||
for key, values := range s.headers {
|
||||
for _, v := range values {
|
||||
req.Header.Add(key, v)
|
||||
}
|
||||
}
|
||||
if len(defaultHeaders) > 0 {
|
||||
|
@ -179,6 +178,10 @@ func (s *PingService) Do(ctx context.Context) (*PingResult, int, error) {
|
|||
req.SetBasicAuth(basicAuthUsername, basicAuthPassword)
|
||||
}
|
||||
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req.Header.Add("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
|
||||
}
|
||||
|
||||
res, err := s.client.c.Do((*http.Request)(req).WithContext(ctx))
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
|
|
36
vendor/github.com/olivere/elastic/v7/pit.go
generated
vendored
Normal file
36
vendor/github.com/olivere/elastic/v7/pit.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2012-present Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
// PointInTime is a lightweight view into the state of the data that existed
|
||||
// when initiated. It can be created with OpenPointInTime API and be used
|
||||
// when searching, e.g. in Search API or with SearchSource.
|
||||
type PointInTime struct {
|
||||
// Id that uniquely identifies the point in time, as created with the
|
||||
// OpenPointInTime API.
|
||||
Id string `json:"id,omitempty"`
|
||||
// KeepAlive is the time for which this specific PointInTime will be
|
||||
// kept alive by Elasticsearch.
|
||||
KeepAlive string `json:"keep_alive,omitempty"`
|
||||
}
|
||||
|
||||
// NewPointInTime creates a new PointInTime.
|
||||
func NewPointInTime(id, keepAlive string) *PointInTime {
|
||||
return &PointInTime{
|
||||
Id: id,
|
||||
KeepAlive: keepAlive,
|
||||
}
|
||||
}
|
||||
|
||||
// Source generates the JSON serializable fragment for the PointInTime.
|
||||
func (pit *PointInTime) Source() (interface{}, error) {
|
||||
if pit == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return map[string]interface{}{
|
||||
"id": pit.Id,
|
||||
"keep_alive": pit.KeepAlive,
|
||||
}, nil
|
||||
}
|
176
vendor/github.com/olivere/elastic/v7/pit_close.go
generated
vendored
Normal file
176
vendor/github.com/olivere/elastic/v7/pit_close.go
generated
vendored
Normal file
|
@ -0,0 +1,176 @@
|
|||
// Copyright 2012-present Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ClosePointInTimeService removes a point in time.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html
|
||||
// for details.
|
||||
type ClosePointInTimeService struct {
|
||||
client *Client
|
||||
|
||||
pretty *bool // pretty format the returned JSON response
|
||||
human *bool // return human readable values for statistics
|
||||
errorTrace *bool // include the stack trace of returned errors
|
||||
filterPath []string // list of filters used to reduce the response
|
||||
headers http.Header // custom request-level HTTP headers
|
||||
|
||||
id string
|
||||
bodyJson interface{}
|
||||
bodyString string
|
||||
}
|
||||
|
||||
// NewClosePointInTimeService creates a new ClosePointInTimeService.
|
||||
func NewClosePointInTimeService(client *Client) *ClosePointInTimeService {
|
||||
return &ClosePointInTimeService{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// Pretty tells Elasticsearch whether to return a formatted JSON response.
|
||||
func (s *ClosePointInTimeService) Pretty(pretty bool) *ClosePointInTimeService {
|
||||
s.pretty = &pretty
|
||||
return s
|
||||
}
|
||||
|
||||
// Human specifies whether human readable values should be returned in
|
||||
// the JSON response, e.g. "7.5mb".
|
||||
func (s *ClosePointInTimeService) Human(human bool) *ClosePointInTimeService {
|
||||
s.human = &human
|
||||
return s
|
||||
}
|
||||
|
||||
// ErrorTrace specifies whether to include the stack trace of returned errors.
|
||||
func (s *ClosePointInTimeService) ErrorTrace(errorTrace bool) *ClosePointInTimeService {
|
||||
s.errorTrace = &errorTrace
|
||||
return s
|
||||
}
|
||||
|
||||
// FilterPath specifies a list of filters used to reduce the response.
|
||||
func (s *ClosePointInTimeService) FilterPath(filterPath ...string) *ClosePointInTimeService {
|
||||
s.filterPath = filterPath
|
||||
return s
|
||||
}
|
||||
|
||||
// Header adds a header to the request.
|
||||
func (s *ClosePointInTimeService) Header(name string, value string) *ClosePointInTimeService {
|
||||
if s.headers == nil {
|
||||
s.headers = http.Header{}
|
||||
}
|
||||
s.headers.Add(name, value)
|
||||
return s
|
||||
}
|
||||
|
||||
// Headers specifies the headers of the request.
|
||||
func (s *ClosePointInTimeService) Headers(headers http.Header) *ClosePointInTimeService {
|
||||
s.headers = headers
|
||||
return s
|
||||
}
|
||||
|
||||
// ID to close.
|
||||
func (s *ClosePointInTimeService) ID(id string) *ClosePointInTimeService {
|
||||
s.id = id
|
||||
return s
|
||||
}
|
||||
|
||||
// BodyJson is the document as a serializable JSON interface.
|
||||
func (s *ClosePointInTimeService) BodyJson(body interface{}) *ClosePointInTimeService {
|
||||
s.bodyJson = body
|
||||
return s
|
||||
}
|
||||
|
||||
// BodyString is the document encoded as a string.
|
||||
func (s *ClosePointInTimeService) BodyString(body string) *ClosePointInTimeService {
|
||||
s.bodyString = body
|
||||
return s
|
||||
}
|
||||
|
||||
// buildURL builds the URL for the operation.
|
||||
func (s *ClosePointInTimeService) buildURL() (string, string, url.Values, error) {
|
||||
var (
|
||||
method = "DELETE"
|
||||
path = "/_pit"
|
||||
)
|
||||
|
||||
// Add query string parameters
|
||||
params := url.Values{}
|
||||
if v := s.pretty; v != nil {
|
||||
params.Set("pretty", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.human; v != nil {
|
||||
params.Set("human", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.errorTrace; v != nil {
|
||||
params.Set("error_trace", fmt.Sprint(*v))
|
||||
}
|
||||
if len(s.filterPath) > 0 {
|
||||
params.Set("filter_path", strings.Join(s.filterPath, ","))
|
||||
}
|
||||
return method, path, params, nil
|
||||
}
|
||||
|
||||
// Validate checks if the operation is valid.
|
||||
func (s *ClosePointInTimeService) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Do executes the operation.
|
||||
func (s *ClosePointInTimeService) Do(ctx context.Context) (*ClosePointInTimeResponse, error) {
|
||||
// Check pre-conditions
|
||||
if err := s.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get URL for request
|
||||
method, path, params, err := s.buildURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Setup HTTP request body
|
||||
var body interface{}
|
||||
if s.id != "" {
|
||||
body = map[string]interface{}{
|
||||
"id": s.id,
|
||||
}
|
||||
} else if s.bodyJson != nil {
|
||||
body = s.bodyJson
|
||||
} else {
|
||||
body = s.bodyString
|
||||
}
|
||||
|
||||
// Get HTTP response
|
||||
res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
|
||||
Method: method,
|
||||
Path: path,
|
||||
Params: params,
|
||||
Body: body,
|
||||
Headers: s.headers,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Return operation response
|
||||
ret := new(ClosePointInTimeResponse)
|
||||
if err := s.client.decoder.Decode(res.Body, ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// ClosePointInTimeResponse is the result of closing a point in time.
|
||||
type ClosePointInTimeResponse struct {
|
||||
Succeeded bool `json:"succeeded,omitempty"`
|
||||
NumFreed int `json:"num_freed,omitempty"`
|
||||
}
|
247
vendor/github.com/olivere/elastic/v7/pit_open.go
generated
vendored
Normal file
247
vendor/github.com/olivere/elastic/v7/pit_open.go
generated
vendored
Normal file
|
@ -0,0 +1,247 @@
|
|||
// Copyright 2012-present Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/olivere/elastic/v7/uritemplates"
|
||||
)
|
||||
|
||||
// OpenPointInTimeService opens a point in time that can be used in subsequent
|
||||
// searches.
|
||||
//
|
||||
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.x/point-in-time-api.html
|
||||
// for details.
|
||||
type OpenPointInTimeService struct {
|
||||
client *Client
|
||||
|
||||
pretty *bool // pretty format the returned JSON response
|
||||
human *bool // return human readable values for statistics
|
||||
errorTrace *bool // include the stack trace of returned errors
|
||||
filterPath []string // list of filters used to reduce the response
|
||||
headers http.Header // custom request-level HTTP headers
|
||||
|
||||
index []string
|
||||
preference string
|
||||
routing string
|
||||
ignoreUnavailable *bool
|
||||
expandWildcards string
|
||||
keepAlive string
|
||||
bodyJson interface{}
|
||||
bodyString string
|
||||
}
|
||||
|
||||
// NewOpenPointInTimeService creates a new OpenPointInTimeService.
|
||||
func NewOpenPointInTimeService(client *Client) *OpenPointInTimeService {
|
||||
return &OpenPointInTimeService{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// Pretty tells Elasticsearch whether to return a formatted JSON response.
|
||||
func (s *OpenPointInTimeService) Pretty(pretty bool) *OpenPointInTimeService {
|
||||
s.pretty = &pretty
|
||||
return s
|
||||
}
|
||||
|
||||
// Human specifies whether human readable values should be returned in
|
||||
// the JSON response, e.g. "7.5mb".
|
||||
func (s *OpenPointInTimeService) Human(human bool) *OpenPointInTimeService {
|
||||
s.human = &human
|
||||
return s
|
||||
}
|
||||
|
||||
// ErrorTrace specifies whether to include the stack trace of returned errors.
|
||||
func (s *OpenPointInTimeService) ErrorTrace(errorTrace bool) *OpenPointInTimeService {
|
||||
s.errorTrace = &errorTrace
|
||||
return s
|
||||
}
|
||||
|
||||
// FilterPath specifies a list of filters used to reduce the response.
|
||||
func (s *OpenPointInTimeService) FilterPath(filterPath ...string) *OpenPointInTimeService {
|
||||
s.filterPath = filterPath
|
||||
return s
|
||||
}
|
||||
|
||||
// Header adds a header to the request.
|
||||
func (s *OpenPointInTimeService) Header(name string, value string) *OpenPointInTimeService {
|
||||
if s.headers == nil {
|
||||
s.headers = http.Header{}
|
||||
}
|
||||
s.headers.Add(name, value)
|
||||
return s
|
||||
}
|
||||
|
||||
// Headers specifies the headers of the request.
|
||||
func (s *OpenPointInTimeService) Headers(headers http.Header) *OpenPointInTimeService {
|
||||
s.headers = headers
|
||||
return s
|
||||
}
|
||||
|
||||
// Preference specifies the node or shard the operation should be performed on.
|
||||
func (s *OpenPointInTimeService) Preference(preference string) *OpenPointInTimeService {
|
||||
s.preference = preference
|
||||
return s
|
||||
}
|
||||
|
||||
// Index is the name of the index (or indices).
|
||||
func (s *OpenPointInTimeService) Index(index ...string) *OpenPointInTimeService {
|
||||
s.index = index
|
||||
return s
|
||||
}
|
||||
|
||||
// Routing is a specific routing value.
|
||||
func (s *OpenPointInTimeService) Routing(routing string) *OpenPointInTimeService {
|
||||
s.routing = routing
|
||||
return s
|
||||
}
|
||||
|
||||
// IgnoreUnavailable indicates whether specified concrete indices should be
|
||||
// ignored when unavailable (missing or closed).
|
||||
func (s *OpenPointInTimeService) IgnoreUnavailable(ignoreUnavailable bool) *OpenPointInTimeService {
|
||||
s.ignoreUnavailable = &ignoreUnavailable
|
||||
return s
|
||||
}
|
||||
|
||||
// ExpandWildcards indicates whether to expand wildcard expression to
|
||||
// concrete indices that are open, closed or both.
|
||||
func (s *OpenPointInTimeService) ExpandWildcards(expandWildcards string) *OpenPointInTimeService {
|
||||
s.expandWildcards = expandWildcards
|
||||
return s
|
||||
}
|
||||
|
||||
// KeepAlive indicates the specific time to live for the point in time.
|
||||
func (s *OpenPointInTimeService) KeepAlive(keepAlive string) *OpenPointInTimeService {
|
||||
s.keepAlive = keepAlive
|
||||
return s
|
||||
}
|
||||
|
||||
// BodyJson is the document as a serializable JSON interface.
|
||||
func (s *OpenPointInTimeService) BodyJson(body interface{}) *OpenPointInTimeService {
|
||||
s.bodyJson = body
|
||||
return s
|
||||
}
|
||||
|
||||
// BodyString is the document encoded as a string.
|
||||
func (s *OpenPointInTimeService) BodyString(body string) *OpenPointInTimeService {
|
||||
s.bodyString = body
|
||||
return s
|
||||
}
|
||||
|
||||
// buildURL builds the URL for the operation.
|
||||
func (s *OpenPointInTimeService) buildURL() (string, string, url.Values, error) {
|
||||
var err error
|
||||
var method, path string
|
||||
|
||||
if len(s.index) > 0 {
|
||||
method = "POST"
|
||||
path, err = uritemplates.Expand("/{index}/_pit", map[string]string{
|
||||
"index": strings.Join(s.index, ","),
|
||||
})
|
||||
} else {
|
||||
method = "POST"
|
||||
path = "/_pit"
|
||||
}
|
||||
if err != nil {
|
||||
return "", "", url.Values{}, err
|
||||
}
|
||||
|
||||
// Add query string parameters
|
||||
params := url.Values{}
|
||||
if v := s.pretty; v != nil {
|
||||
params.Set("pretty", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.human; v != nil {
|
||||
params.Set("human", fmt.Sprint(*v))
|
||||
}
|
||||
if v := s.errorTrace; v != nil {
|
||||
params.Set("error_trace", fmt.Sprint(*v))
|
||||
}
|
||||
if len(s.filterPath) > 0 {
|
||||
params.Set("filter_path", strings.Join(s.filterPath, ","))
|
||||
}
|
||||
if s.preference != "" {
|
||||
params.Set("preference", s.preference)
|
||||
}
|
||||
if s.routing != "" {
|
||||
params.Set("routing", s.routing)
|
||||
}
|
||||
if s.ignoreUnavailable != nil {
|
||||
params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
|
||||
}
|
||||
if s.expandWildcards != "" {
|
||||
params.Set("expand_wildcards", s.expandWildcards)
|
||||
}
|
||||
if s.keepAlive != "" {
|
||||
params.Set("keep_alive", s.keepAlive)
|
||||
}
|
||||
return method, path, params, nil
|
||||
}
|
||||
|
||||
// Validate checks if the operation is valid.
|
||||
func (s *OpenPointInTimeService) Validate() error {
|
||||
var invalid []string
|
||||
if len(s.index) == 0 {
|
||||
invalid = append(invalid, "Index")
|
||||
}
|
||||
if s.keepAlive == "" {
|
||||
invalid = append(invalid, "KeepAlive")
|
||||
}
|
||||
if len(invalid) > 0 {
|
||||
return fmt.Errorf("missing required fields: %v", invalid)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Do executes the operation.
|
||||
func (s *OpenPointInTimeService) Do(ctx context.Context) (*OpenPointInTimeResponse, error) {
|
||||
// Check pre-conditions
|
||||
if err := s.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get URL for request
|
||||
method, path, params, err := s.buildURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Setup HTTP request body
|
||||
var body interface{}
|
||||
if s.bodyJson != nil {
|
||||
body = s.bodyJson
|
||||
} else {
|
||||
body = s.bodyString
|
||||
}
|
||||
|
||||
// Get HTTP response
|
||||
res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
|
||||
Method: method,
|
||||
Path: path,
|
||||
Params: params,
|
||||
Body: body,
|
||||
Headers: s.headers,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Return operation response
|
||||
ret := new(OpenPointInTimeResponse)
|
||||
if err := s.client.decoder.Decode(res.Body, ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// OpenPointInTimeResponse is the result of opening a point in time.
|
||||
type OpenPointInTimeResponse struct {
|
||||
Id string `json:"id,omitempty"`
|
||||
}
|
2
vendor/github.com/olivere/elastic/v7/request.go
generated
vendored
2
vendor/github.com/olivere/elastic/v7/request.go
generated
vendored
|
@ -11,7 +11,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -24,7 +23,6 @@ func NewRequest(method, url string) (*Request, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Add("User-Agent", "elastic/"+Version+" ("+runtime.GOOS+"-"+runtime.GOARCH+")")
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
return (*Request)(req), nil
|
||||
|
|
10
vendor/github.com/olivere/elastic/v7/response.go
generated
vendored
10
vendor/github.com/olivere/elastic/v7/response.go
generated
vendored
|
@ -24,21 +24,25 @@ type Response struct {
|
|||
// Header is the HTTP header from the HTTP response.
|
||||
// Keys in the map are canonicalized (see http.CanonicalHeaderKey).
|
||||
Header http.Header
|
||||
// Body is the deserialized response body.
|
||||
// Body is the deserialized response body. Only available if streaming is disabled.
|
||||
Body json.RawMessage
|
||||
// DeprecationWarnings lists all deprecation warnings returned from
|
||||
// Elasticsearch.
|
||||
DeprecationWarnings []string
|
||||
// BodyReader is the body as a reader. Only available if streaming is enabled.
|
||||
BodyReader io.ReadCloser
|
||||
}
|
||||
|
||||
// newResponse creates a new response from the HTTP response.
|
||||
func (c *Client) newResponse(res *http.Response, maxBodySize int64) (*Response, error) {
|
||||
func (c *Client) newResponse(res *http.Response, maxBodySize int64, stream bool) (*Response, error) {
|
||||
r := &Response{
|
||||
StatusCode: res.StatusCode,
|
||||
Header: res.Header,
|
||||
DeprecationWarnings: res.Header["Warning"],
|
||||
}
|
||||
if res.Body != nil {
|
||||
if stream {
|
||||
r.BodyReader = res.Body
|
||||
} else if res.Body != nil {
|
||||
body := io.Reader(res.Body)
|
||||
if maxBodySize > 0 {
|
||||
if res.ContentLength > maxBodySize {
|
||||
|
|
10
vendor/github.com/olivere/elastic/v7/search.go
generated
vendored
10
vendor/github.com/olivere/elastic/v7/search.go
generated
vendored
|
@ -152,6 +152,13 @@ func (s *SearchService) Collapse(collapse *CollapseBuilder) *SearchService {
|
|||
return s
|
||||
}
|
||||
|
||||
// PointInTime specifies an optional PointInTime to be used in the context
|
||||
// of this search.
|
||||
func (s *SearchService) PointInTime(pointInTime *PointInTime) *SearchService {
|
||||
s.searchSource = s.searchSource.PointInTime(pointInTime)
|
||||
return s
|
||||
}
|
||||
|
||||
// TimeoutInMillis sets the timeout in milliseconds.
|
||||
func (s *SearchService) TimeoutInMillis(timeoutInMillis int) *SearchService {
|
||||
s.searchSource = s.searchSource.TimeoutInMillis(timeoutInMillis)
|
||||
|
@ -655,6 +662,7 @@ type SearchResult struct {
|
|||
Profile *SearchProfile `json:"profile,omitempty"` // profiling results, if optional Profile API was active for this search
|
||||
Shards *ShardsInfo `json:"_shards,omitempty"` // shard information
|
||||
Status int `json:"status,omitempty"` // used in MultiSearch
|
||||
PitId string `json:"pit_id,omitempty"` // Point In Time ID
|
||||
}
|
||||
|
||||
// SearchResultCluster holds information about a search response
|
||||
|
@ -669,7 +677,7 @@ type SearchResultCluster struct {
|
|||
// a search result. The return value might not be accurate, unless
|
||||
// track_total_hits parameter has set to true.
|
||||
func (r *SearchResult) TotalHits() int64 {
|
||||
if r.Hits != nil && r.Hits.TotalHits != nil {
|
||||
if r != nil && r.Hits != nil && r.Hits.TotalHits != nil {
|
||||
return r.Hits.TotalHits.Value
|
||||
}
|
||||
return 0
|
||||
|
|
15
vendor/github.com/olivere/elastic/v7/search_aggs.go
generated
vendored
15
vendor/github.com/olivere/elastic/v7/search_aggs.go
generated
vendored
|
@ -580,6 +580,21 @@ func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool) {
|
|||
return nil, false
|
||||
}
|
||||
|
||||
// GeoTile returns geo-tile aggregation results.
|
||||
// https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geotilegrid-aggregation.html
|
||||
func (a Aggregations) GeoTile(name string) (*AggregationBucketKeyItems, bool) {
|
||||
if raw, found := a[name]; found {
|
||||
agg := new(AggregationBucketKeyItems)
|
||||
if raw == nil {
|
||||
return agg, true
|
||||
}
|
||||
if err := json.Unmarshal(raw, agg); err == nil {
|
||||
return agg, true
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// GeoCentroid returns geo-centroid aggregation results.
|
||||
// See: https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-metrics-geocentroid-aggregation.html
|
||||
func (a Aggregations) GeoCentroid(name string) (*AggregationGeoCentroidMetric, bool) {
|
||||
|
|
119
vendor/github.com/olivere/elastic/v7/search_aggs_bucket_geotile_grid.go
generated
vendored
Normal file
119
vendor/github.com/olivere/elastic/v7/search_aggs_bucket_geotile_grid.go
generated
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
package elastic
|
||||
|
||||
import "errors"
|
||||
|
||||
type GeoTileGridAggregation struct {
|
||||
field string
|
||||
precision int
|
||||
size int
|
||||
shardSize int
|
||||
bounds *BoundingBox
|
||||
subAggregations map[string]Aggregation
|
||||
meta map[string]interface{}
|
||||
}
|
||||
|
||||
// NewGeoTileGridAggregation Create new bucket aggregation of Geotile grid type
|
||||
// https://www.elastic.co/guide/en/elasticsearch/reference/7.0/search-aggregations-bucket-geotilegrid-aggregation.html
|
||||
func NewGeoTileGridAggregation() *GeoTileGridAggregation {
|
||||
return &GeoTileGridAggregation{
|
||||
precision: -1,
|
||||
size: -1,
|
||||
shardSize: -1,
|
||||
subAggregations: make(map[string]Aggregation),
|
||||
}
|
||||
}
|
||||
|
||||
// Field The name of the field indexed with GeoPoints. Mandatory.
|
||||
func (a *GeoTileGridAggregation) Field(field string) *GeoTileGridAggregation {
|
||||
a.field = field
|
||||
return a
|
||||
}
|
||||
|
||||
// Precision The integer zoom of the key used to define cells/buckets in the results. Defaults to 7. Values outside of [0,29] will be rejected. Optional.
|
||||
func (a *GeoTileGridAggregation) Precision(precision int) *GeoTileGridAggregation {
|
||||
a.precision = precision
|
||||
return a
|
||||
}
|
||||
|
||||
// Size The maximum number of buckets to return in the result structure. Optional.
|
||||
func (a *GeoTileGridAggregation) Size(size int) *GeoTileGridAggregation {
|
||||
a.size = size
|
||||
return a
|
||||
}
|
||||
|
||||
// ShardSize The maximum number of buckets to return from each shard. Optional.
|
||||
func (a *GeoTileGridAggregation) ShardSize(shardSize int) *GeoTileGridAggregation {
|
||||
a.shardSize = shardSize
|
||||
return a
|
||||
}
|
||||
|
||||
// Bounds The bounding box to filter the points in the bucket. Optional.
|
||||
func (a *GeoTileGridAggregation) Bounds(boundingBox BoundingBox) *GeoTileGridAggregation {
|
||||
a.bounds = &boundingBox
|
||||
return a
|
||||
}
|
||||
|
||||
// SubAggregation Adds a sub-aggregation to this aggregation.
|
||||
func (a *GeoTileGridAggregation) SubAggregation(name string, subAggregation Aggregation) *GeoTileGridAggregation {
|
||||
a.subAggregations[name] = subAggregation
|
||||
return a
|
||||
}
|
||||
|
||||
// Meta Sets the meta data to be included in the aggregation response.
|
||||
func (a *GeoTileGridAggregation) Meta(metaData map[string]interface{}) *GeoTileGridAggregation {
|
||||
a.meta = metaData
|
||||
return a
|
||||
}
|
||||
|
||||
// Source returns the a JSON-serializable interface.
|
||||
func (a *GeoTileGridAggregation) Source() (interface{}, error) {
|
||||
source := make(map[string]interface{})
|
||||
opts := make(map[string]interface{})
|
||||
source["geotile_grid"] = opts
|
||||
|
||||
if a.field == "" {
|
||||
return nil, errors.New("elastic: 'field' is a mandatory parameter")
|
||||
}
|
||||
opts["field"] = a.field
|
||||
|
||||
if a.precision != -1 {
|
||||
opts["precision"] = a.precision
|
||||
}
|
||||
|
||||
if a.size != -1 {
|
||||
opts["size"] = a.size
|
||||
}
|
||||
|
||||
if a.shardSize != -1 {
|
||||
opts["shard_size"] = a.shardSize
|
||||
}
|
||||
|
||||
if a.bounds != nil {
|
||||
opts["bounds"] = *a.bounds
|
||||
}
|
||||
|
||||
if len(a.subAggregations) > 0 {
|
||||
aggsMap := make(map[string]interface{})
|
||||
source["aggregations"] = aggsMap
|
||||
for name, aggregate := range a.subAggregations {
|
||||
src, err := aggregate.Source()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
aggsMap[name] = src
|
||||
}
|
||||
}
|
||||
|
||||
if len(a.meta) > 0 {
|
||||
source["meta"] = a.meta
|
||||
}
|
||||
|
||||
return source, nil
|
||||
|
||||
}
|
||||
|
||||
// BoundingBox bounding box
|
||||
type BoundingBox struct {
|
||||
TopLeft GeoPoint `json:"top_left"`
|
||||
BottomRight GeoPoint `json:"bottom_right"`
|
||||
}
|
22
vendor/github.com/olivere/elastic/v7/search_queries_match_phrase.go
generated
vendored
22
vendor/github.com/olivere/elastic/v7/search_queries_match_phrase.go
generated
vendored
|
@ -10,12 +10,13 @@ package elastic
|
|||
// For more details, see
|
||||
// https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-match-query-phrase.html
|
||||
type MatchPhraseQuery struct {
|
||||
name string
|
||||
value interface{}
|
||||
analyzer string
|
||||
slop *int
|
||||
boost *float64
|
||||
queryName string
|
||||
name string
|
||||
value interface{}
|
||||
analyzer string
|
||||
slop *int
|
||||
boost *float64
|
||||
queryName string
|
||||
zeroTermsQuery string
|
||||
}
|
||||
|
||||
// NewMatchPhraseQuery creates and initializes a new MatchPhraseQuery.
|
||||
|
@ -36,6 +37,12 @@ func (q *MatchPhraseQuery) Slop(slop int) *MatchPhraseQuery {
|
|||
return q
|
||||
}
|
||||
|
||||
// ZeroTermsQuery can be "all" or "none".
|
||||
func (q *MatchPhraseQuery) ZeroTermsQuery(zeroTermsQuery string) *MatchPhraseQuery {
|
||||
q.zeroTermsQuery = zeroTermsQuery
|
||||
return q
|
||||
}
|
||||
|
||||
// Boost sets the boost to apply to this query.
|
||||
func (q *MatchPhraseQuery) Boost(boost float64) *MatchPhraseQuery {
|
||||
q.boost = &boost
|
||||
|
@ -68,6 +75,9 @@ func (q *MatchPhraseQuery) Source() (interface{}, error) {
|
|||
if q.slop != nil {
|
||||
query["slop"] = *q.slop
|
||||
}
|
||||
if q.zeroTermsQuery != "" {
|
||||
query["zero_terms_query"] = q.zeroTermsQuery
|
||||
}
|
||||
if q.boost != nil {
|
||||
query["boost"] = *q.boost
|
||||
}
|
||||
|
|
29
vendor/github.com/olivere/elastic/v7/search_queries_wildcard.go
generated
vendored
29
vendor/github.com/olivere/elastic/v7/search_queries_wildcard.go
generated
vendored
|
@ -13,13 +13,14 @@ package elastic
|
|||
// The wildcard query maps to Lucene WildcardQuery.
|
||||
//
|
||||
// For more details, see
|
||||
// https://www.elastic.co/guide/en/elasticsearch/reference/7.0/query-dsl-wildcard-query.html
|
||||
// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl-wildcard-query.html
|
||||
type WildcardQuery struct {
|
||||
name string
|
||||
wildcard string
|
||||
boost *float64
|
||||
rewrite string
|
||||
queryName string
|
||||
name string
|
||||
wildcard string
|
||||
boost *float64
|
||||
rewrite string
|
||||
queryName string
|
||||
caseInsensitive bool
|
||||
}
|
||||
|
||||
// NewWildcardQuery creates and initializes a new WildcardQuery.
|
||||
|
@ -47,13 +48,20 @@ func (q *WildcardQuery) QueryName(queryName string) *WildcardQuery {
|
|||
return q
|
||||
}
|
||||
|
||||
// CaseInsensitive sets case insensitive matching of this query.
|
||||
func (q *WildcardQuery) CaseInsensitive(caseInsensitive bool) *WildcardQuery {
|
||||
q.caseInsensitive = caseInsensitive
|
||||
return q
|
||||
}
|
||||
|
||||
// Source returns the JSON serializable body of this query.
|
||||
func (q *WildcardQuery) Source() (interface{}, error) {
|
||||
// {
|
||||
// "wildcard" : {
|
||||
// "user" : {
|
||||
// "wildcard" : "ki*y",
|
||||
// "boost" : 1.0
|
||||
// "value" : "ki*y",
|
||||
// "boost" : 1.0,
|
||||
// "case_insensitive" : true
|
||||
// }
|
||||
// }
|
||||
|
||||
|
@ -65,7 +73,7 @@ func (q *WildcardQuery) Source() (interface{}, error) {
|
|||
wq := make(map[string]interface{})
|
||||
query[q.name] = wq
|
||||
|
||||
wq["wildcard"] = q.wildcard
|
||||
wq["value"] = q.wildcard
|
||||
|
||||
if q.boost != nil {
|
||||
wq["boost"] = *q.boost
|
||||
|
@ -76,6 +84,9 @@ func (q *WildcardQuery) Source() (interface{}, error) {
|
|||
if q.queryName != "" {
|
||||
wq["_name"] = q.queryName
|
||||
}
|
||||
if q.caseInsensitive {
|
||||
wq["case_insensitive"] = true
|
||||
}
|
||||
|
||||
return source, nil
|
||||
}
|
||||
|
|
7
vendor/github.com/olivere/elastic/v7/search_request.go
generated
vendored
7
vendor/github.com/olivere/elastic/v7/search_request.go
generated
vendored
|
@ -413,6 +413,13 @@ func (r *SearchRequest) Collapse(collapse *CollapseBuilder) *SearchRequest {
|
|||
return r
|
||||
}
|
||||
|
||||
// PointInTime specifies an optional PointInTime to be used in the context
|
||||
// of this search.
|
||||
func (s *SearchRequest) PointInTime(pointInTime *PointInTime) *SearchRequest {
|
||||
s.searchSource = s.searchSource.PointInTime(pointInTime)
|
||||
return s
|
||||
}
|
||||
|
||||
// AllowPartialSearchResults indicates if this request should allow partial
|
||||
// results. (If method is not called, will default to the cluster level
|
||||
// setting).
|
||||
|
|
17
vendor/github.com/olivere/elastic/v7/search_source.go
generated
vendored
17
vendor/github.com/olivere/elastic/v7/search_source.go
generated
vendored
|
@ -42,6 +42,7 @@ type SearchSource struct {
|
|||
collapse *CollapseBuilder // collapse
|
||||
profile bool // profile
|
||||
// TODO extBuilders []SearchExtBuilder // ext
|
||||
pointInTime *PointInTime // pit
|
||||
}
|
||||
|
||||
// NewSearchSource initializes a new SearchSource.
|
||||
|
@ -367,6 +368,13 @@ func (s *SearchSource) Collapse(collapse *CollapseBuilder) *SearchSource {
|
|||
return s
|
||||
}
|
||||
|
||||
// PointInTime specifies an optional PointInTime to be used in the context
|
||||
// of this search.
|
||||
func (s *SearchSource) PointInTime(pointInTime *PointInTime) *SearchSource {
|
||||
s.pointInTime = pointInTime
|
||||
return s
|
||||
}
|
||||
|
||||
// Source returns the serializable JSON for the source builder.
|
||||
func (s *SearchSource) Source() (interface{}, error) {
|
||||
source := make(map[string]interface{})
|
||||
|
@ -597,6 +605,15 @@ func (s *SearchSource) Source() (interface{}, error) {
|
|||
source["inner_hits"] = m
|
||||
}
|
||||
|
||||
// Point in Time
|
||||
if s.pointInTime != nil {
|
||||
src, err := s.pointInTime.Source()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
source["pit"] = src
|
||||
}
|
||||
|
||||
return source, nil
|
||||
}
|
||||
|
||||
|
|
10
vendor/github.com/olivere/elastic/v7/update_by_query.go
generated
vendored
10
vendor/github.com/olivere/elastic/v7/update_by_query.go
generated
vendored
|
@ -46,6 +46,7 @@ type UpdateByQueryService struct {
|
|||
ignoreUnavailable *bool
|
||||
lenient *bool
|
||||
lowercaseExpandedTerms *bool
|
||||
maxDocs *int
|
||||
pipeline string
|
||||
preference string
|
||||
q string
|
||||
|
@ -275,6 +276,12 @@ func (s *UpdateByQueryService) LowercaseExpandedTerms(lowercaseExpandedTerms boo
|
|||
return s
|
||||
}
|
||||
|
||||
// MaxDocs specifies maximum number of documents to process
|
||||
func (s *UpdateByQueryService) MaxDocs(maxDocs int) *UpdateByQueryService {
|
||||
s.maxDocs = &maxDocs
|
||||
return s
|
||||
}
|
||||
|
||||
// Pipeline specifies the ingest pipeline to set on index requests made by this action (default: none).
|
||||
func (s *UpdateByQueryService) Pipeline(pipeline string) *UpdateByQueryService {
|
||||
s.pipeline = pipeline
|
||||
|
@ -567,6 +574,9 @@ func (s *UpdateByQueryService) buildURL() (string, url.Values, error) {
|
|||
if v := s.lowercaseExpandedTerms; v != nil {
|
||||
params.Set("lowercase_expanded_terms", fmt.Sprint(*v))
|
||||
}
|
||||
if s.maxDocs != nil {
|
||||
params.Set("max_docs", fmt.Sprintf("%d", *s.maxDocs))
|
||||
}
|
||||
if s.pipeline != "" {
|
||||
params.Set("pipeline", s.pipeline)
|
||||
}
|
||||
|
|
2
vendor/github.com/olivere/elastic/v7/xpack_security_get_role.go
generated
vendored
2
vendor/github.com/olivere/elastic/v7/xpack_security_get_role.go
generated
vendored
|
@ -174,7 +174,7 @@ type XPackSecurityRole struct {
|
|||
type XPackSecurityApplicationPrivileges struct {
|
||||
Application string `json:"application"`
|
||||
Privileges []string `json:"privileges"`
|
||||
Ressources []string `json:"resources"`
|
||||
Resources []string `json:"resources"`
|
||||
}
|
||||
|
||||
// XPackSecurityIndicesPermissions is the indices permission object
|
||||
|
|
5
vendor/github.com/olivere/elastic/v7/xpack_security_put_user.go
generated
vendored
5
vendor/github.com/olivere/elastic/v7/xpack_security_put_user.go
generated
vendored
|
@ -206,10 +206,5 @@ type XPackSecurityPutUserRequest struct {
|
|||
|
||||
// XPackSecurityPutUserResponse is the response of XPackSecurityPutUserService.Do.
|
||||
type XPackSecurityPutUserResponse struct {
|
||||
User XPackSecurityPutUser `json:"user"`
|
||||
}
|
||||
|
||||
// XPackSecurityPutUser is the response containing the creation information
|
||||
type XPackSecurityPutUser struct {
|
||||
Created bool `json:"created"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue