Skip to content

Commit 4f7c977

Browse files
committed
Fix documentation links
1 parent 1731e8f commit 4f7c977

File tree

149 files changed

+289
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+289
-257
lines changed

CONTRIBUTORS

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Sean DuBois [@Sean-Der](https://github.com/Sean-Der)
6868
Shalin LK [@shalinlk](https://github.com/shalinlk)
6969
Stephen Kubovic [@stephenkubovic](https://github.com/stephenkubovic)
7070
Stuart Warren [@Woz](https://github.com/stuart-warren)
71+
Sulaiman [@salajlan](https://github.com/salajlan)
7172
Sundar [@sundarv85](https://github.com/sundarv85)
7273
Take [ww24](https://github.com/ww24)
7374
Tetsuya Morimoto [@t2y](https://github.com/t2y)

bulk.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
// reuse BulkService to send many batches. You do not have to create a new
2525
// BulkService for each batch.
2626
//
27-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html
27+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
2828
// for more details.
2929
type BulkService struct {
3030
client *Client

bulk_delete_request.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// BulkDeleteRequest is a request to remove a document from Elasticsearch.
1616
//
17-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html
17+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
1818
// for details.
1919
type BulkDeleteRequest struct {
2020
BulkableRequest
@@ -100,7 +100,7 @@ func (r *BulkDeleteRequest) String() string {
100100

101101
// Source returns the on-wire representation of the delete request,
102102
// split into an action-and-meta-data line and an (optional) source line.
103-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
103+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
104104
// for details.
105105
func (r *BulkDeleteRequest) Source() ([]string, error) {
106106
if r.source != nil {

bulk_index_request.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
// BulkIndexRequest is a request to add a document to Elasticsearch.
1414
//
15-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html
15+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
1616
// for details.
1717
type BulkIndexRequest struct {
1818
BulkableRequest
@@ -65,7 +65,7 @@ func (r *BulkIndexRequest) Id(id string) *BulkIndexRequest {
6565

6666
// OpType specifies if this request should follow create-only or upsert
6767
// behavior. This follows the OpType of the standard document index API.
68-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#operation-type
68+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html#operation-type
6969
// for details.
7070
func (r *BulkIndexRequest) OpType(opType string) *BulkIndexRequest {
7171
r.opType = opType
@@ -98,7 +98,7 @@ func (r *BulkIndexRequest) Version(version int64) *BulkIndexRequest {
9898
// VersionType specifies how versions are created. It can be e.g. internal,
9999
// external, external_gte, or force.
100100
//
101-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning
101+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html#index-versioning
102102
// for details.
103103
func (r *BulkIndexRequest) VersionType(versionType string) *BulkIndexRequest {
104104
r.versionType = versionType
@@ -146,7 +146,7 @@ func (r *BulkIndexRequest) String() string {
146146

147147
// Source returns the on-wire representation of the index request,
148148
// split into an action-and-meta-data line and an (optional) source line.
149-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
149+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
150150
// for details.
151151
func (r *BulkIndexRequest) Source() ([]string, error) {
152152
// { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }

bulk_update_request.go

+19-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
// BulkUpdateRequest is a request to update a document in Elasticsearch.
1414
//
15-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-bulk.html
15+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
1616
// for details.
1717
type BulkUpdateRequest struct {
1818
BulkableRequest
@@ -23,6 +23,7 @@ type BulkUpdateRequest struct {
2323
routing string
2424
parent string
2525
script *Script
26+
scriptedUpsert *bool
2627
version int64 // default is MATCH_ANY
2728
versionType string // default is "internal"
2829
retryOnConflict *int
@@ -77,15 +78,25 @@ func (r *BulkUpdateRequest) Parent(parent string) *BulkUpdateRequest {
7778
}
7879

7980
// Script specifies an update script.
80-
// See https://www.elastic.co/guide/en/elasticsearch/reference/2.x/docs-bulk.html#bulk-update
81-
// and https://www.elastic.co/guide/en/elasticsearch/reference/2.x/modules-scripting.html
81+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html#bulk-update
82+
// and https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-scripting.html
8283
// for details.
8384
func (r *BulkUpdateRequest) Script(script *Script) *BulkUpdateRequest {
8485
r.script = script
8586
r.source = nil
8687
return r
8788
}
8889

90+
// ScripedUpsert specifies if your script will run regardless of
91+
// whether the document exists or not.
92+
//
93+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-update.html#_literal_scripted_upsert_literal
94+
func (r *BulkUpdateRequest) ScriptedUpsert(upsert bool) *BulkUpdateRequest {
95+
r.scriptedUpsert = &upsert
96+
r.source = nil
97+
return r
98+
}
99+
89100
// RetryOnConflict specifies how often to retry in case of a version conflict.
90101
func (r *BulkUpdateRequest) RetryOnConflict(retryOnConflict int) *BulkUpdateRequest {
91102
r.retryOnConflict = &retryOnConflict
@@ -119,7 +130,7 @@ func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest {
119130
// DocAsUpsert indicates whether the contents of Doc should be used as
120131
// the Upsert value.
121132
//
122-
// See https://www.elastic.co/guide/en/elasticsearch/reference/2.x/docs-update.html#_literal_doc_as_upsert_literal
133+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-update.html#_literal_doc_as_upsert_literal
123134
// for details.
124135
func (r *BulkUpdateRequest) DocAsUpsert(docAsUpsert bool) *BulkUpdateRequest {
125136
r.docAsUpsert = &docAsUpsert
@@ -175,7 +186,7 @@ func (r *BulkUpdateRequest) getSourceAsString(data interface{}) (string, error)
175186

176187
// Source returns the on-wire representation of the update request,
177188
// split into an action-and-meta-data line and an (optional) source line.
178-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
189+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-bulk.html
179190
// for details.
180191
func (r BulkUpdateRequest) Source() ([]string, error) {
181192
// { "update" : { "_index" : "test", "_type" : "type1", "_id" : "1", ... } }
@@ -235,6 +246,9 @@ func (r BulkUpdateRequest) Source() ([]string, error) {
235246
if r.upsert != nil {
236247
source["upsert"] = r.upsert
237248
}
249+
if r.scriptedUpsert != nil {
250+
source["scripted_upsert"] = *r.scriptedUpsert
251+
}
238252
if r.doc != nil {
239253
// {"doc":{...}}
240254
source["doc"] = r.doc

bulk_update_request_test.go

+20-4
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,38 @@ func TestBulkUpdateRequestSerialization(t *testing.T) {
6767
`{"detect_noop":true,"doc":{"counter":42}}`,
6868
},
6969
},
70+
// #4
71+
{
72+
Request: NewBulkUpdateRequest().Index("index1").Type("tweet").Id("1").
73+
RetryOnConflict(3).
74+
ScriptedUpsert(true).
75+
Script(NewScript(`ctx._source.retweets += param1`).Lang("javascript").Param("param1", 42)).
76+
Upsert(struct {
77+
Counter int64 `json:"counter"`
78+
}{
79+
Counter: 42,
80+
}),
81+
Expected: []string{
82+
`{"update":{"_id":"1","_index":"index1","_retry_on_conflict":3,"_type":"tweet"}}`,
83+
`{"script":{"inline":"ctx._source.retweets += param1","lang":"javascript","params":{"param1":42}},"scripted_upsert":true,"upsert":{"counter":42}}`,
84+
},
85+
},
7086
}
7187

7288
for i, test := range tests {
7389
lines, err := test.Request.Source()
7490
if err != nil {
75-
t.Fatalf("case #%d: expected no error, got: %v", i, err)
91+
t.Fatalf("#%d: expected no error, got: %v", i, err)
7692
}
7793
if lines == nil {
78-
t.Fatalf("case #%d: expected lines, got nil", i)
94+
t.Fatalf("#%d: expected lines, got nil", i)
7995
}
8096
if len(lines) != len(test.Expected) {
81-
t.Fatalf("case #%d: expected %d lines, got %d", i, len(test.Expected), len(lines))
97+
t.Fatalf("#%d: expected %d lines, got %d", i, len(test.Expected), len(lines))
8298
}
8399
for j, line := range lines {
84100
if line != test.Expected[j] {
85-
t.Errorf("case #%d: expected line #%d to be\n%s\nbut got:\n%s", i, j, test.Expected[j], line)
101+
t.Errorf("#%d: expected line #%d to be\n%s\nbut got:\n%s", i, j, test.Expected[j], line)
86102
}
87103
}
88104
}

clear_scroll.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// ClearScrollService clears one or more scroll contexts by their ids.
1616
//
17-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html#_clear_scroll_api
17+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-scroll.html#_clear_scroll_api
1818
// for details.
1919
type ClearScrollService struct {
2020
client *Client

client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ type Client struct {
155155
//
156156
// If the sniffer is enabled (the default), the new client then sniffes
157157
// the cluster via the Nodes Info API
158-
// (see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html#cluster-nodes-info).
158+
// (see https://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-nodes-info.html#cluster-nodes-info).
159159
// It uses the URLs specified by the caller. The caller is responsible
160160
// to only pass a list of URLs of nodes that belong to the same cluster.
161161
// This sniffing process is run on startup and periodically.
@@ -1284,7 +1284,7 @@ func (c *Client) BulkProcessor() *BulkProcessorService {
12841284

12851285
// Reindex copies data from a source index into a destination index.
12861286
//
1287-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
1287+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-reindex.html
12881288
// for details on the Reindex API.
12891289
func (c *Client) Reindex() *ReindexService {
12901290
return NewReindexService(c)

cluster_health.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// ClusterHealthService allows to get a very simple status on the health of the cluster.
1818
//
19-
// See http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html
19+
// See http://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-health.html
2020
// for details.
2121
type ClusterHealthService struct {
2222
client *Client

cluster_state.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// ClusterStateService allows to get a comprehensive state information of the whole cluster.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-state.html
2020
// for details.
2121
type ClusterStateService struct {
2222
client *Client

cluster_stats.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import (
1414
"gopkg.in/olivere/elastic.v5/uritemplates"
1515
)
1616

17-
// ClusterStatsService is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.4/cluster-stats.html.
17+
// ClusterStatsService is documented at
18+
// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/cluster-stats.html.
1819
type ClusterStatsService struct {
1920
client *Client
2021
pretty bool

delete.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// DeleteService allows to delete a typed JSON document from a specified
1717
// index based on its id.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-delete.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-delete.html
2020
// for details.
2121
type DeleteService struct {
2222
client *Client

delete_by_query.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
// DeleteByQueryService deletes documents that match a query.
18-
// See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-delete-by-query.html.
18+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-delete-by-query.html.
1919
type DeleteByQueryService struct {
2020
client *Client
2121
index []string

delete_template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
// DeleteTemplateService deletes a search template. More information can
17-
// be found at http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html.
17+
// be found at https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-template.html.
1818
type DeleteTemplateService struct {
1919
client *Client
2020
pretty bool

doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/*
66
Package elastic provides an interface to the Elasticsearch server
7-
(http://www.elasticsearch.org/).
7+
(https://www.elastic.co/products/elasticsearch).
88
99
The first thing you do is to create a Client. If you have Elasticsearch
1010
installed and running with its default settings

exists.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// ExistsService checks for the existence of a document using HEAD.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-get.html
2020
// for details.
2121
type ExistsService struct {
2222
client *Client

explain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// ExplainService computes a score explanation for a query and
1818
// a specific document.
19-
// See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-explain.html.
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-explain.html.
2020
type ExplainService struct {
2121
client *Client
2222
pretty bool

field_stats.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
// FieldStatsService allows finding statistical properties of a field without executing a search,
2424
// but looking up measurements that are natively available in the Lucene index.
2525
//
26-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-stats.html
26+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-field-stats.html
2727
// for details
2828
type FieldStatsService struct {
2929
client *Client

get.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
// GetService allows to get a typed JSON document from the index based
1919
// on its id.
2020
//
21-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
21+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-get.html
2222
// for details.
2323
type GetService struct {
2424
client *Client

get_template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
// GetTemplateService reads a search template.
17-
// It is documented at http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html.
17+
// It is documented at https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-template.html.
1818
type GetTemplateService struct {
1919
client *Client
2020
pretty bool

highlight.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package elastic
66

77
// Highlight allows highlighting search results on one or more fields.
88
// For details, see:
9-
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html
9+
// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-highlighting.html
1010
type Highlight struct {
1111
fields []*HighlighterField
1212
tagsSchema *string

index.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// IndexService adds or updates a typed JSON document in a specified index,
1717
// making it searchable.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-index_.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html
2020
// for details.
2121
type IndexService struct {
2222
client *Client
@@ -173,7 +173,7 @@ func (s *IndexService) buildURL() (string, string, url.Values, error) {
173173
})
174174
} else {
175175
// Automatic ID generation
176-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-creation
176+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/docs-index_.html#index-creation
177177
method = "POST"
178178
path, err = uritemplates.Expand("/{index}/{type}/", map[string]string{
179179
"index": s.index,

indices_analyze.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// IndicesAnalyzeService performs the analysis process on a text and returns
1717
// the tokens breakdown of the text.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-analyze.html
2020
// for detail.
2121
type IndicesAnalyzeService struct {
2222
client *Client
@@ -186,7 +186,7 @@ func (s *IndicesAnalyzeService) Do(ctx context.Context) (*IndicesAnalyzeResponse
186186
} else {
187187
// Request parameters are deprecated in 5.1.1, and we must use a JSON
188188
// structure in the body to pass the parameters.
189-
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.1/indices-analyze.html
189+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-analyze.html
190190
body = s.request
191191
}
192192

indices_close.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
// IndicesCloseService closes an index.
1717
//
18-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
18+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-open-close.html
1919
// for details.
2020
type IndicesCloseService struct {
2121
client *Client

indices_create.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
// IndicesCreateService creates a new index.
1717
//
18-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
18+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-create-index.html
1919
// for details.
2020
type IndicesCreateService struct {
2121
client *Client

indices_delete.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// IndicesDeleteService allows to delete existing indices.
1818
//
19-
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
19+
// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/indices-delete-index.html
2020
// for details.
2121
type IndicesDeleteService struct {
2222
client *Client

0 commit comments

Comments
 (0)