Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
* Fix documentation links, typos and other minor annoyances
* Add .gometalinter.json
  • Loading branch information
olivere committed Mar 24, 2018
1 parent 614e037 commit ffff59e
Show file tree
Hide file tree
Showing 149 changed files with 337 additions and 280 deletions.
37 changes: 37 additions & 0 deletions .gometalinter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"Vendor": false,
"Deadline": "2m",
"Sort": ["linter", "severity", "path", "line"],
"DisableAll": true,
"Enable": [
"deadcode",
"dupl",
"gocyclo",
"gofmt",
"goimports",
"golint",
"gosimple",
"ineffassign",
"interfacer",
"lll",
"megacheck",
"misspell",
"nakedret",
"structcheck",
"unconvert",
"unparam",
"unused",
"varcheck",
"vet"
],
"EnableGC": true,
"WarnUnmatchedDirective": true,
"Cyclo": 24,
"LineLength": 200,
"Exclude": [
"generator",
"spec",
"tmp",
".*_easyjson.go"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import "github.com/olivere/elastic"

Elastic 6.0 targets Elasticsearch 6.x which was [released on 14th November 2017](https://www.elastic.co/blog/elasticsearch-6-0-0-released).

Notice that there are will be a lot of [breaking changes in Elasticsearch 6.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking-changes-6.0.html)
Notice that there are will be a lot of [breaking changes in Elasticsearch 6.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/breaking-changes-6.0.html)
and we used this as an opportunity to [clean up and refactor Elastic](https://github.com/olivere/elastic/blob/release-branch.v6/CHANGELOG-6.0.md)
as we did in the transition from earlier versions of Elastic.

Expand Down
2 changes: 1 addition & 1 deletion bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
// reuse BulkService to send many batches. You do not have to create a new
// BulkService for each batch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for more details.
type BulkService struct {
client *Client
Expand Down
4 changes: 2 additions & 2 deletions bulk_delete_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// BulkDeleteRequest is a request to remove a document from Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
type BulkDeleteRequest struct {
BulkableRequest
Expand Down Expand Up @@ -128,7 +128,7 @@ func (r *BulkDeleteRequest) String() string {

// Source returns the on-wire representation of the delete request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
func (r *BulkDeleteRequest) Source() ([]string, error) {
if r.source != nil {
Expand Down
8 changes: 4 additions & 4 deletions bulk_index_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// BulkIndexRequest is a request to add a document to Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
type BulkIndexRequest struct {
BulkableRequest
Expand Down Expand Up @@ -95,7 +95,7 @@ func (r *BulkIndexRequest) Id(id string) *BulkIndexRequest {

// OpType specifies if this request should follow create-only or upsert
// behavior. This follows the OpType of the standard document index API.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-index_.html#operation-type
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-index_.html#operation-type
// for details.
func (r *BulkIndexRequest) OpType(opType string) *BulkIndexRequest {
r.opType = opType
Expand Down Expand Up @@ -128,7 +128,7 @@ func (r *BulkIndexRequest) Version(version int64) *BulkIndexRequest {
// 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/6.0/docs-index_.html#index-versioning
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-index_.html#index-versioning
// for details.
func (r *BulkIndexRequest) VersionType(versionType string) *BulkIndexRequest {
r.versionType = versionType
Expand Down Expand Up @@ -169,7 +169,7 @@ func (r *BulkIndexRequest) String() string {

// Source returns the on-wire representation of the index request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
func (r *BulkIndexRequest) Source() ([]string, error) {
// { "index" : { "_index" : "test", "_type" : "type1", "_id" : "1" } }
Expand Down
12 changes: 6 additions & 6 deletions bulk_update_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// BulkUpdateRequest is a request to update a document in Elasticsearch.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
type BulkUpdateRequest struct {
BulkableRequest
Expand Down Expand Up @@ -120,8 +120,8 @@ func (r *BulkUpdateRequest) Parent(parent string) *BulkUpdateRequest {
}

// Script specifies an update script.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html#bulk-update
// and https://www.elastic.co/guide/en/elasticsearch/reference/6.0/modules-scripting.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html#bulk-update
// and https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting.html
// for details.
func (r *BulkUpdateRequest) Script(script *Script) *BulkUpdateRequest {
r.script = script
Expand All @@ -132,7 +132,7 @@ func (r *BulkUpdateRequest) Script(script *Script) *BulkUpdateRequest {
// ScripedUpsert specifies if your script will run regardless of
// whether the document exists or not.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-update.html#_literal_scripted_upsert_literal
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-update.html#_literal_scripted_upsert_literal
func (r *BulkUpdateRequest) ScriptedUpsert(upsert bool) *BulkUpdateRequest {
r.scriptedUpsert = &upsert
r.source = nil
Expand Down Expand Up @@ -172,7 +172,7 @@ func (r *BulkUpdateRequest) Doc(doc interface{}) *BulkUpdateRequest {
// DocAsUpsert indicates whether the contents of Doc should be used as
// the Upsert value.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-update.html#_literal_doc_as_upsert_literal
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-update.html#_literal_doc_as_upsert_literal
// for details.
func (r *BulkUpdateRequest) DocAsUpsert(docAsUpsert bool) *BulkUpdateRequest {
r.docAsUpsert = &docAsUpsert
Expand Down Expand Up @@ -218,7 +218,7 @@ func (r *BulkUpdateRequest) String() string {

// Source returns the on-wire representation of the update request,
// split into an action-and-meta-data line and an (optional) source line.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-bulk.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-bulk.html
// for details.
func (r *BulkUpdateRequest) Source() ([]string, error) {
// { "update" : { "_index" : "test", "_type" : "type1", "_id" : "1", ... } }
Expand Down
2 changes: 1 addition & 1 deletion clear_scroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// ClearScrollService clears one or more scroll contexts by their ids.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-scroll.html#_clear_scroll_api
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-scroll.html#_clear_scroll_api
// for details.
type ClearScrollService struct {
client *Client
Expand Down
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

const (
// Version is the current version of Elastic.
Version = "6.1.12"
Version = "6.1.13"

// 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.
Expand Down Expand Up @@ -154,7 +154,7 @@ type Client struct {
//
// If the sniffer is enabled (the default), the new client then sniffes
// the cluster via the Nodes Info API
// (see https://www.elastic.co/guide/en/elasticsearch/reference/6.0/cluster-nodes-info.html#cluster-nodes-info).
// (see https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-nodes-info.html#cluster-nodes-info).
// It uses the URLs specified by the caller. The caller is responsible
// to only pass a list of URLs of nodes that belong to the same cluster.
// This sniffing process is run on startup and periodically.
Expand Down Expand Up @@ -1383,7 +1383,7 @@ func (c *Client) BulkProcessor() *BulkProcessorService {

// Reindex copies data from a source index into a destination index.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-reindex.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-reindex.html
// for details on the Reindex API.
func (c *Client) Reindex() *ReindexService {
return NewReindexService(c)
Expand Down
2 changes: 1 addition & 1 deletion cluster_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// ClusterStateService allows to get a comprehensive state information of the whole cluster.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/cluster-state.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-state.html
// for details.
type ClusterStateService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion cluster_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// ClusterStatsService is documented at
// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/cluster-stats.html.
// https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-stats.html.
type ClusterStatsService struct {
client *Client
pretty bool
Expand Down
2 changes: 1 addition & 1 deletion delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// DeleteService allows to delete a typed JSON document from a specified
// index based on its id.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-delete.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-delete.html
// for details.
type DeleteService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion delete_by_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// DeleteByQueryService deletes documents that match a query.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-delete-by-query.html.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-delete-by-query.html.
type DeleteByQueryService struct {
client *Client
index []string
Expand Down
2 changes: 1 addition & 1 deletion exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// ExistsService checks for the existence of a document using HEAD.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-get.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-get.html
// for details.
type ExistsService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// ExplainService computes a score explanation for a query and
// a specific document.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-explain.html.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-explain.html.
type ExplainService struct {
client *Client
pretty bool
Expand Down
2 changes: 1 addition & 1 deletion fetch_source_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// with various endpoints, e.g. when searching for documents, retrieving
// individual documents, or even updating documents.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-source-filtering.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-source-filtering.html
// for details.
type FetchSourceContext struct {
fetchSource bool
Expand Down
2 changes: 1 addition & 1 deletion field_caps.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// FieldCapsService allows retrieving the capabilities of fields among multiple indices.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-field-caps.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-field-caps.html
// for details
type FieldCapsService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion get.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// GetService allows to get a typed JSON document from the index based
// on its id.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-get.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-get.html
// for details.
type GetService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package elastic

// Highlight allows highlighting search results on one or more fields.
// For details, see:
// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-request-highlighting.html
// https://www.elastic.co/guide/en/elasticsearch/reference/6.2/search-request-highlighting.html
type Highlight struct {
fields []*HighlighterField
tagsSchema *string
Expand Down
4 changes: 2 additions & 2 deletions index.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// IndexService adds or updates a typed JSON document in a specified index,
// making it searchable.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-index_.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-index_.html
// for details.
type IndexService struct {
client *Client
Expand Down Expand Up @@ -175,7 +175,7 @@ func (s *IndexService) buildURL() (string, string, url.Values, error) {
})
} else {
// Automatic ID generation
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docs-index_.html#index-creation
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/docs-index_.html#index-creation
method = "POST"
path, err = uritemplates.Expand("/{index}/{type}/", map[string]string{
"index": s.index,
Expand Down
4 changes: 2 additions & 2 deletions indices_analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// IndicesAnalyzeService performs the analysis process on a text and returns
// the tokens breakdown of the text.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-analyze.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-analyze.html
// for detail.
type IndicesAnalyzeService struct {
client *Client
Expand Down Expand Up @@ -185,7 +185,7 @@ func (s *IndicesAnalyzeService) Do(ctx context.Context) (*IndicesAnalyzeResponse
} else {
// Request parameters are deprecated in 5.1.1, and we must use a JSON
// structure in the body to pass the parameters.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-analyze.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-analyze.html
body = s.request
}

Expand Down
2 changes: 1 addition & 1 deletion indices_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// IndicesCloseService closes an index.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-open-close.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-open-close.html
// for details.
type IndicesCloseService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// IndicesCreateService creates a new index.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-create-index.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-create-index.html
// for details.
type IndicesCreateService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// IndicesDeleteService allows to delete existing indices.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-delete-index.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-delete-index.html
// for details.
type IndicesDeleteService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_delete_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// IndicesDeleteTemplateService deletes index templates.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-templates.html.
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-templates.html.
type IndicesDeleteTemplateService struct {
client *Client
pretty bool
Expand Down
2 changes: 1 addition & 1 deletion indices_exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// IndicesExistsService checks if an index or indices exist or not.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-exists.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-exists.html
// for details.
type IndicesExistsService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_exists_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

// IndicesExistsTypeService checks if one or more types exist in one or more indices.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-types-exists.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-types-exists.html
// for details.
type IndicesExistsTypeService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// basically frees memory from the index by flushing data to the index
// storage and clearing the internal transaction log.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-flush.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-flush.html
// for details.
type IndicesFlushService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// IndicesGetService retrieves information about one or more indices.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-get-index.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-get-index.html
// for more details.
type IndicesGetService struct {
client *Client
Expand Down
2 changes: 1 addition & 1 deletion indices_get_field_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// IndicesGetFieldMappingService retrieves the mapping definitions for the fields in an index
// or index/type.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/indices-get-field-mapping.html
// See https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-get-field-mapping.html
// for details.
type IndicesGetFieldMappingService struct {
client *Client
Expand Down
Loading

0 comments on commit ffff59e

Please sign in to comment.