Commit 9b547ee8 authored by ale's avatar ale
Browse files

Merge branch 'renovate/github.com-olivere-elastic-v7-7.x' into 'master'

Update module github.com/olivere/elastic/v7 to v7.0.25

See merge request !6
parents 5f875bab b8337ad0
Pipeline #17299 passed with stages
in 46 seconds
......@@ -4,4 +4,4 @@ go 1.11
// go: no requirements found in vendor/vendor.json
require github.com/olivere/elastic/v7 v7.0.24
require github.com/olivere/elastic/v7 v7.0.25
......@@ -3,6 +3,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/aws/aws-sdk-go v1.33.5/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.35.20/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k=
github.com/aws/aws-sdk-go v1.38.3/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go v1.38.17/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
......@@ -58,6 +59,8 @@ github.com/olivere/elastic/v7 v7.0.23 h1:b7tjMogDMhf2CisGI+L02LXLVa0ZyE82Z15XfW1
github.com/olivere/elastic/v7 v7.0.23/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY=
github.com/olivere/elastic/v7 v7.0.24 h1:9ZcCQP3Pvgese7TaypYiVAL49sCEphyIwkVxtRf8jb8=
github.com/olivere/elastic/v7 v7.0.24/go.mod h1:OuWmD2DiuYhddWegBKPWQuelVKBLrW0fa/VUYgxuGTY=
github.com/olivere/elastic/v7 v7.0.25 h1:q3ef8PqC4PyT3b8BAcjDVo48KNzr0HVKosMqMsF+oME=
github.com/olivere/elastic/v7 v7.0.25/go.mod h1:ySKeM+7yrE9HmsUi6+vSp0anvWiDOuPa9kpuknxjKbU=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
......
......@@ -32,6 +32,7 @@ arthurgustin [@arthurgustin](https://github.com/arthurgustin)
Bas van Dijk [@basvandijk](https://github.com/basvandijk)
Benjamin Fernandes [@LotharSee](https://github.com/LotharSee)
Benjamin Zarzycki [@kf6nux](https://github.com/kf6nux)
bestgopher [@bestgopher](https://github.com/bestgopher)
Björn Gerdau [@kernle32dll](https://github.com/kernle32dll)
Boris Popovschi [@Zyqsempai](https://github.com/Zyqsempai)
Bowei Xu [@vancexu](https://github.com/vancexu)
......@@ -148,6 +149,7 @@ mmfrb [@mmfrb](https://github.com/mmfrb)
mnpritula [@mnpritula](https://github.com/mnpritula)
mosa [@mosasiru](https://github.com/mosasiru)
Muhammet Çakır [@cakirmuha](https://github.com/cakirmuha)
Munkyu Im [@munkyu](https://github.com/munkyu)
naimulhaider [@naimulhaider](https://github.com/naimulhaider)
Naoya Yoshizawa [@azihsoyn](https://github.com/azihsoyn)
navins [@ishare](https://github.com/ishare)
......
......@@ -196,7 +196,7 @@ Here are a few tips on how to get used to Elastic:
- [x] Sum
- [ ] T-test (X-pack)
- [x] Top Hits
- [ ] Top metrics (X-pack)
- [x] Top metrics (X-pack)
- [x] Value Count
- [x] Weighted avg
- Bucket Aggregations
......@@ -333,6 +333,7 @@ Here are a few tips on how to get used to Elastic:
- [x] Inner hits
- Full text queries
- [x] Match Query
- [x] Match Boolean Prefix Query
- [x] Match Phrase Query
- [x] Match Phrase Prefix Query
- [x] Multi Match Query
......
......@@ -26,7 +26,7 @@ import (
const (
// Version is the current version of Elastic.
Version = "7.0.24"
Version = "7.0.25"
// 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.
......@@ -1842,7 +1842,31 @@ func (c *Client) IndexDeleteIndexTemplate(name string) *IndicesDeleteIndexTempla
return NewIndicesDeleteIndexTemplateService(c).Name(name)
}
// -- TODO Component templates --
// -- Component templates --
// IndexPutComponentTemplate creates or updates a component template (available since 7.8).
//
// This service implements the component templates as described
// on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-component-template.html.
func (c *Client) IndexPutComponentTemplate(name string) *IndicesPutComponentTemplateService {
return NewIndicesPutComponentTemplateService(c).Name(name)
}
// IndexGetComponentTemplate returns a component template (available since 7.8).
//
// This service implements the component templates as described
// on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/getting-component-templates.html.
func (c *Client) IndexGetComponentTemplate(name string) *IndicesGetComponentTemplateService {
return NewIndicesGetComponentTemplateService(c).Name(name)
}
// IndexDeleteComponentTemplate deletes a component template (available since 7.8).
//
// This service implements the component templates as described
// on https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-component-template.html.
func (c *Client) IndexDeleteComponentTemplate(name string) *IndicesDeleteComponentTemplateService {
return NewIndicesDeleteComponentTemplateService(c).Name(name)
}
// GetMapping gets a mapping.
func (c *Client) GetMapping() *IndicesGetMappingService {
......
......@@ -2,7 +2,7 @@ version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2
hostname: elasticsearch
environment:
- cluster.name=elasticsearch
......@@ -14,6 +14,7 @@ services:
# - network.host=_local_
- network.publish_host=127.0.0.1
- logger.org.elasticsearch=warn
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
nproc: 65536
......@@ -28,7 +29,7 @@ services:
ports:
- 9200:9200
platinum:
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2
hostname: elasticsearch-platinum
environment:
- cluster.name=platinum
......
......@@ -204,19 +204,15 @@ func IsStatusCode(err interface{}, code int) bool {
// ShardsInfo represents information from a shard.
type ShardsInfo struct {
Total int `json:"total"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Failures []*ShardFailure `json:"failures,omitempty"`
Skipped int `json:"skipped,omitempty"`
}
// ShardFailure represents details about a failure.
type ShardFailure struct {
Index string `json:"_index,omitempty"`
Shard int `json:"_shard,omitempty"`
Node string `json:"_node,omitempty"`
Reason map[string]interface{} `json:"reason,omitempty"`
Status string `json:"status,omitempty"`
Primary bool `json:"primary,omitempty"`
Total int `json:"total"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Failures []*FailedNodeException `json:"failures,omitempty"`
Skipped int `json:"skipped,omitempty"`
}
// FailedNodeException returns an error on the node level.
type FailedNodeException struct {
*ErrorDetails
NodeId string `json:"node_id"`
}
......@@ -3,9 +3,8 @@ module github.com/olivere/elastic/v7
go 1.14
require (
github.com/aws/aws-sdk-go v1.38.3
github.com/aws/aws-sdk-go v1.38.17
github.com/fortytw2/leaktest v1.3.0
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/google/go-cmp v0.5.5
github.com/mailru/easyjson v0.7.7
github.com/opentracing/opentracing-go v1.2.0
......
......@@ -27,9 +27,12 @@ type IndicesDeleteService struct {
filterPath []string // list of filters used to reduce the response
headers http.Header // custom request-level HTTP headers
index []string
timeout string
masterTimeout string
index []string
timeout string
masterTimeout string
ignoreUnavailable *bool
allowNoIndices *bool
expandWildcards string
}
// NewIndicesDeleteService creates and initializes a new IndicesDeleteService.
......@@ -99,6 +102,26 @@ func (s *IndicesDeleteService) MasterTimeout(masterTimeout string) *IndicesDelet
return s
}
// IgnoreUnavailable indicates whether to ignore unavailable indexes (default: false).
func (s *IndicesDeleteService) IgnoreUnavailable(ignoreUnavailable bool) *IndicesDeleteService {
s.ignoreUnavailable = &ignoreUnavailable
return s
}
// AllowNoIndices indicates whether to ignore if a wildcard expression
// resolves to no concrete indices (default: false).
func (s *IndicesDeleteService) AllowNoIndices(allowNoIndices bool) *IndicesDeleteService {
s.allowNoIndices = &allowNoIndices
return s
}
// ExpandWildcards indicates whether wildcard expressions should get
// expanded to open or closed indices (default: open).
func (s *IndicesDeleteService) ExpandWildcards(expandWildcards string) *IndicesDeleteService {
s.expandWildcards = expandWildcards
return s
}
// buildURL builds the URL for the operation.
func (s *IndicesDeleteService) buildURL() (string, url.Values, error) {
// Build URL
......@@ -129,6 +152,15 @@ func (s *IndicesDeleteService) buildURL() (string, url.Values, error) {
if s.masterTimeout != "" {
params.Set("master_timeout", s.masterTimeout)
}
if s.ignoreUnavailable != nil {
params.Set("ignore_unavailable", fmt.Sprintf("%v", *s.ignoreUnavailable))
}
if s.allowNoIndices != nil {
params.Set("allow_no_indices", fmt.Sprintf("%v", *s.allowNoIndices))
}
if s.expandWildcards != "" {
params.Set("expand_wildcards", s.expandWildcards)
}
return path, params, nil
}
......
// 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"
)
// IndicesDeleteComponentTemplateService deletes component templates.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-delete-component-template.html
// for more details.
type IndicesDeleteComponentTemplateService 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
name string
timeout string
masterTimeout string
}
// NewIndicesDeleteComponentTemplateService creates a new IndicesDeleteComponentTemplateService.
func NewIndicesDeleteComponentTemplateService(client *Client) *IndicesDeleteComponentTemplateService {
return &IndicesDeleteComponentTemplateService{
client: client,
}
}
// Pretty tells Elasticsearch whether to return a formatted JSON response.
func (s *IndicesDeleteComponentTemplateService) Pretty(pretty bool) *IndicesDeleteComponentTemplateService {
s.pretty = &pretty
return s
}
// Human specifies whether human readable values should be returned in
// the JSON response, e.g. "7.5mb".
func (s *IndicesDeleteComponentTemplateService) Human(human bool) *IndicesDeleteComponentTemplateService {
s.human = &human
return s
}
// ErrorTrace specifies whether to include the stack trace of returned errors.
func (s *IndicesDeleteComponentTemplateService) ErrorTrace(errorTrace bool) *IndicesDeleteComponentTemplateService {
s.errorTrace = &errorTrace
return s
}
// FilterPath specifies a list of filters used to reduce the response.
func (s *IndicesDeleteComponentTemplateService) FilterPath(filterPath ...string) *IndicesDeleteComponentTemplateService {
s.filterPath = filterPath
return s
}
// Header adds a header to the request.
func (s *IndicesDeleteComponentTemplateService) Header(name string, value string) *IndicesDeleteComponentTemplateService {
if s.headers == nil {
s.headers = http.Header{}
}
s.headers.Add(name, value)
return s
}
// Headers specifies the headers of the request.
func (s *IndicesDeleteComponentTemplateService) Headers(headers http.Header) *IndicesDeleteComponentTemplateService {
s.headers = headers
return s
}
// Name is the name of the template.
func (s *IndicesDeleteComponentTemplateService) Name(name string) *IndicesDeleteComponentTemplateService {
s.name = name
return s
}
// Timeout is an explicit operation timeout.
func (s *IndicesDeleteComponentTemplateService) Timeout(timeout string) *IndicesDeleteComponentTemplateService {
s.timeout = timeout
return s
}
// MasterTimeout specifies the timeout for connection to master.
func (s *IndicesDeleteComponentTemplateService) MasterTimeout(masterTimeout string) *IndicesDeleteComponentTemplateService {
s.masterTimeout = masterTimeout
return s
}
// buildURL builds the URL for the operation.
func (s *IndicesDeleteComponentTemplateService) buildURL() (string, url.Values, error) {
// Build URL
path, err := uritemplates.Expand("/_component_template/{name}", map[string]string{
"name": s.name,
})
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.timeout != "" {
params.Set("timeout", s.timeout)
}
if s.masterTimeout != "" {
params.Set("master_timeout", s.masterTimeout)
}
return path, params, nil
}
// Validate checks if the operation is valid.
func (s *IndicesDeleteComponentTemplateService) Validate() error {
var invalid []string
if s.name == "" {
invalid = append(invalid, "Name")
}
if len(invalid) > 0 {
return fmt.Errorf("missing required fields: %v", invalid)
}
return nil
}
// Do executes the operation.
func (s *IndicesDeleteComponentTemplateService) Do(ctx context.Context) (*IndicesDeleteComponentTemplateResponse, error) {
// Check pre-conditions
if err := s.Validate(); err != nil {
return nil, err
}
// 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: "DELETE",
Path: path,
Params: params,
Headers: s.headers,
})
if err != nil {
return nil, err
}
// Return operation response
ret := new(IndicesDeleteComponentTemplateResponse)
if err := s.client.decoder.Decode(res.Body, ret); err != nil {
return nil, err
}
return ret, nil
}
// IndicesDeleteComponentTemplateResponse is the response of IndicesDeleteComponentTemplateService.Do.
type IndicesDeleteComponentTemplateResponse struct {
Acknowledged bool `json:"acknowledged"`
ShardsAcknowledged bool `json:"shards_acknowledged"`
Index string `json:"index,omitempty"`
}
// 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"
)
// IndicesGetComponentTemplateService returns a component template.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/getting-component-templates.html
// for more details.
type IndicesGetComponentTemplateService 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
name []string
masterTimeout string
flatSettings *bool
local *bool
}
// NewIndicesGetComponentTemplateService creates a new IndicesGetComponentTemplateService.
func NewIndicesGetComponentTemplateService(client *Client) *IndicesGetComponentTemplateService {
return &IndicesGetComponentTemplateService{
client: client,
name: make([]string, 0),
}
}
// Pretty tells Elasticsearch whether to return a formatted JSON response.
func (s *IndicesGetComponentTemplateService) Pretty(pretty bool) *IndicesGetComponentTemplateService {
s.pretty = &pretty
return s
}
// Human specifies whether human readable values should be returned in
// the JSON response, e.g. "7.5mb".
func (s *IndicesGetComponentTemplateService) Human(human bool) *IndicesGetComponentTemplateService {
s.human = &human
return s
}
// ErrorTrace specifies whether to include the stack trace of returned errors.
func (s *IndicesGetComponentTemplateService) ErrorTrace(errorTrace bool) *IndicesGetComponentTemplateService {
s.errorTrace = &errorTrace
return s
}
// FilterPath specifies a list of filters used to reduce the response.
func (s *IndicesGetComponentTemplateService) FilterPath(filterPath ...string) *IndicesGetComponentTemplateService {
s.filterPath = filterPath
return s
}
// Header adds a header to the request.
func (s *IndicesGetComponentTemplateService) Header(name string, value string) *IndicesGetComponentTemplateService {
if s.headers == nil {
s.headers = http.Header{}
}
s.headers.Add(name, value)
return s
}
// Headers specifies the headers of the request.
func (s *IndicesGetComponentTemplateService) Headers(headers http.Header) *IndicesGetComponentTemplateService {
s.headers = headers
return s
}
// Name is the name of the component template.
func (s *IndicesGetComponentTemplateService) Name(name ...string) *IndicesGetComponentTemplateService {
s.name = append(s.name, name...)
return s
}
// FlatSettings is returns settings in flat format (default: false).
func (s *IndicesGetComponentTemplateService) FlatSettings(flatSettings bool) *IndicesGetComponentTemplateService {
s.flatSettings = &flatSettings
return s
}
// Local indicates whether to return local information, i.e. do not retrieve
// the state from master node (default: false).
func (s *IndicesGetComponentTemplateService) Local(local bool) *IndicesGetComponentTemplateService {
s.local = &local
return s
}
// MasterTimeout specifies the timeout for connection to master.
func (s *IndicesGetComponentTemplateService) MasterTimeout(masterTimeout string) *IndicesGetComponentTemplateService {
s.masterTimeout = masterTimeout
return s
}
// buildURL builds the URL for the operation.
func (s *IndicesGetComponentTemplateService) buildURL() (string, url.Values, error) {
// Build URL
var err error
var path string
if len(s.name) > 0 {
path, err = uritemplates.Expand("/_component_template/{name}", map[string]string{
"name": strings.Join(s.name, ","),
})
} else {
path = "/_component_template"
}
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.flatSettings != nil {
params.Set("flat_settings", fmt.Sprintf("%v", *s.flatSettings))
}
if s.local != nil {
params.Set("local", fmt.Sprintf("%v", *s.local))
}
if s.masterTimeout != "" {
params.Set("master_timeout", s.masterTimeout)
}
return path, params, nil
}
// Validate checks if the operation is valid.
func (s *IndicesGetComponentTemplateService) Validate() error {
return nil
}
// Do executes the operation.
func (s *IndicesGetComponentTemplateService) Do(ctx context.Context) (*IndicesGetComponentTemplateResponse, error) {
// Check pre-conditions
if err := s.Validate(); err != nil {
return nil, err
}
// 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
}