From c43a6a5d7f033900c8e1a01d0e0e11ea72e5552e Mon Sep 17 00:00:00 2001 From: Matthew Baird Date: Thu, 26 Sep 2013 11:35:04 -0700 Subject: [PATCH] documentation update so godoc doesn't replicate license information. Also improved comments to conform to godoc. Part 2 --- api/baseRequest.go | 8 +++----- api/baseResponse.go | 8 +++----- api/request.go | 6 ++---- api/searchdsl.go | 6 ++---- api/shared.go | 6 ++---- cluster/clusterReroute.go | 8 +++----- cluster/health.go | 8 +++----- cluster/nodesHotThreads.go | 6 ++---- cluster/nodesInfo.go | 6 ++---- cluster/nodesShutdown.go | 6 ++---- cluster/state.go | 6 ++---- cluster/updateSettings.go | 6 ++---- cookbooks/elasticsearch | 2 +- core/bulk.go | 6 ++---- core/bulkUDP.go | 6 ++---- core/bulk_test.go | 6 ++---- core/count.go | 16 +++++++--------- core/deleteByQuery.go | 10 ++++------ core/example_test.go | 6 ++---- core/explain.go | 10 ++++------ core/get.go | 27 ++++++++++++--------------- core/index.go | 8 +++----- core/mget.go | 10 ++++------ core/moreLikeThis.go | 8 +++----- core/msearch.go | 6 ++---- core/percolate.go | 10 ++++------ core/search.go | 10 ++++------ core/search_test.go | 6 ++---- core/test_test.go | 6 ++---- core/update.go | 12 +++++------- core/validate.go | 8 +++----- doc.go | 15 +++++++++++++++ indices/aliases.go | 8 +++----- indices/analyze.go | 6 ++---- indices/clearCache.go | 6 ++---- indices/createIndex.go | 6 ++---- indices/deleteIndex.go | 6 ++---- indices/deleteMapping.go | 6 ++---- indices/doc.go | 12 ++++++++++++ indices/flush.go | 12 +++++------- indices/getSettings.go | 6 ++---- indices/indicesExists.go | 6 ++---- indices/openCloseIndex.go | 6 ++---- indices/optimize.go | 6 ++---- indices/putMapping.go | 6 ++---- indices/refresh.go | 10 ++++------ indices/segments.go | 6 ++---- indices/snapshot.go | 6 ++---- indices/stats.go | 6 ++---- indices/status.go | 7 ++----- indices/templates.go | 6 ++---- indices/updateSettings.go | 6 ++---- search/facet.go | 6 ++---- search/facet_test.go | 6 ++---- search/filter.go | 20 +++++++++----------- search/filter_test.go | 6 ++---- search/query.go | 24 +++++++++++------------- search/search.go | 16 +++++++--------- search/search_test.go | 6 ++---- search/sort.go | 8 +++----- search/test_test.go | 6 ++---- tutorial/start_1.go | 11 +++++++++++ 62 files changed, 218 insertions(+), 298 deletions(-) create mode 100644 doc.go create mode 100644 indices/doc.go diff --git a/api/baseRequest.go b/api/baseRequest.go index 7ea11250..6ecbd429 100644 --- a/api/baseRequest.go +++ b/api/baseRequest.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api import ( @@ -67,7 +65,7 @@ func DoCommand(method string, url string, data interface{}) ([]byte, error) { return body, nil } -// The API also allows to check for the existance of a document using HEAD +// Exists allows the caller to check for the existance of a document using HEAD // This appears to be broken in the current version of elasticsearch 0.19.10, currently // returning nothing func Exists(pretty bool, index string, _type string, id string) (BaseResponse, error) { diff --git a/api/baseResponse.go b/api/baseResponse.go index 3fb3ca4d..7c3fc0f5 100644 --- a/api/baseResponse.go +++ b/api/baseResponse.go @@ -1,21 +1,19 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api import ( "fmt" -) +) type BaseResponse struct { Ok bool `json:"ok"` diff --git a/api/request.go b/api/request.go index a1304999..29fe7e6b 100644 --- a/api/request.go +++ b/api/request.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api import ( diff --git a/api/searchdsl.go b/api/searchdsl.go index 098fc97e..3fafb8a7 100644 --- a/api/searchdsl.go +++ b/api/searchdsl.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api type SearchRequest struct { diff --git a/api/shared.go b/api/shared.go index a7d96527..5f0ac1f0 100644 --- a/api/shared.go +++ b/api/shared.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package api type Query struct { diff --git a/cluster/clusterReroute.go b/cluster/clusterReroute.go index a3657f78..0fecb4bd 100644 --- a/cluster/clusterReroute.go +++ b/cluster/clusterReroute.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster import ( @@ -23,7 +21,7 @@ import ( // The cluster health API allows to get a very simple status on the health of the cluster. // see http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html // TODO: implement wait_for_status, timeout, wait_for_relocating_shards, wait_for_nodes -// TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health +// TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health // information returned. Defaults to cluster.) func Reroute(pretty bool, dryRun bool, commands Commands) (ClusterHealthResponse, error) { var url string diff --git a/cluster/health.go b/cluster/health.go index b399195e..e4e4f354 100644 --- a/cluster/health.go +++ b/cluster/health.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster import ( @@ -23,7 +21,7 @@ import ( // The cluster health API allows to get a very simple status on the health of the cluster. // see http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html // TODO: implement wait_for_status, timeout, wait_for_relocating_shards, wait_for_nodes -// TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health +// TODO: implement level (Can be one of cluster, indices or shards. Controls the details level of the health // information returned. Defaults to cluster.) func Health(pretty bool, indices ...string) (ClusterHealthResponse, error) { var url string diff --git a/cluster/nodesHotThreads.go b/cluster/nodesHotThreads.go index 6f021c7b..7073423c 100644 --- a/cluster/nodesHotThreads.go +++ b/cluster/nodesHotThreads.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster \ No newline at end of file diff --git a/cluster/nodesInfo.go b/cluster/nodesInfo.go index f790c5d3..f4c2565f 100644 --- a/cluster/nodesInfo.go +++ b/cluster/nodesInfo.go @@ -1,15 +1,13 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster diff --git a/cluster/nodesShutdown.go b/cluster/nodesShutdown.go index 6f021c7b..7073423c 100644 --- a/cluster/nodesShutdown.go +++ b/cluster/nodesShutdown.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster \ No newline at end of file diff --git a/cluster/state.go b/cluster/state.go index c3eb7229..ee7d036a 100644 --- a/cluster/state.go +++ b/cluster/state.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster import ( diff --git a/cluster/updateSettings.go b/cluster/updateSettings.go index 6f021c7b..7073423c 100644 --- a/cluster/updateSettings.go +++ b/cluster/updateSettings.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package cluster \ No newline at end of file diff --git a/cookbooks/elasticsearch b/cookbooks/elasticsearch index 8d2e6722..864d5963 160000 --- a/cookbooks/elasticsearch +++ b/cookbooks/elasticsearch @@ -1 +1 @@ -Subproject commit 8d2e6722baa99e43ec8ab73d75d15c4af94cbfcc +Subproject commit 864d5963cff2572bee5159725bc80d1c788bd3a1 diff --git a/core/bulk.go b/core/bulk.go index 80676236..cb50b92d 100644 --- a/core/bulk.go +++ b/core/bulk.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( diff --git a/core/bulkUDP.go b/core/bulkUDP.go index 15c366ba..05274467 100644 --- a/core/bulkUDP.go +++ b/core/bulkUDP.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core diff --git a/core/bulk_test.go b/core/bulk_test.go index c83e6d03..33582ba1 100644 --- a/core/bulk_test.go +++ b/core/bulk_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( diff --git a/core/count.go b/core/count.go index b21292bb..8ae79054 100644 --- a/core/count.go +++ b/core/count.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -24,12 +22,12 @@ type CountResponse struct { Shard api.Status `json:"_shards"` } -// The count API allows to easily execute a query and get the number of matches for that query. -// It can be executed across one or more indices and across one or more types. -// The query can either be provided using a simple query string as a parameter, -//or using the Query DSL defined within the request body. +// Count allows the caller to easily execute a query and get the number of matches for that query. +// It can be executed across one or more indices and across one or more types. +// The query can either be provided using a simple query string as a parameter, +// or using the Query DSL defined within the request body. // http://www.elasticsearch.org/guide/reference/api/count.html -// TODO: take parameters. +// TODO: take parameters. // currently not working against 0.19.10 func Count(pretty bool, index string, _type string) (CountResponse, error) { var url string diff --git a/core/deleteByQuery.go b/core/deleteByQuery.go index a5f6d5c9..f5db0991 100644 --- a/core/deleteByQuery.go +++ b/core/deleteByQuery.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -20,8 +18,8 @@ import ( "strings" ) -// The delete by query API allows to delete documents from one or more indices and one or more types based on a query. -// The query can either be provided using a simple query string as a parameter, or using the Query DSL defined within +// DeleteByQuery allows the caller to delete documents from one or more indices and one or more types based on a query. +// The query can either be provided using a simple query string as a parameter, or using the Query DSL defined within // the request body. // see: http://www.elasticsearch.org/guide/reference/api/delete-by-query.html func DeleteByQuery(pretty bool, indices []string, types []string, query interface{}) (api.BaseResponse, error) { diff --git a/core/example_test.go b/core/example_test.go index e567345c..837e5ad8 100644 --- a/core/example_test.go +++ b/core/example_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core_test import ( diff --git a/core/explain.go b/core/explain.go index 4e2180f6..f93fe601 100644 --- a/core/explain.go +++ b/core/explain.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,8 +17,8 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The explain api computes a score explanation for a query and a specific document. -// This can give useful feedback whether a document matches or didn’t match a specific query. +// Explain computes a score explanation for a query and a specific document. +// This can give useful feedback whether a document matches or didn’t match a specific query. // This feature is available from version 0.19.9 and up. // see http://www.elasticsearch.org/guide/reference/api/explain.html func Explain(pretty bool, index string, _type string, id string, query string) (api.Match, error) { diff --git a/core/get.go b/core/get.go index 6c7852b4..fbc6d231 100644 --- a/core/get.go +++ b/core/get.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,7 +17,7 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The get API allows to get a typed JSON document from the index based on its id. +// Get allows caller to get a typed JSON document from the index based on its id. // GET - retrieves the doc // HEAD - checks for existence of the doc // http://www.elasticsearch.org/guide/reference/api/get.html @@ -47,13 +45,12 @@ func Get(pretty bool, index string, _type string, id string) (api.BaseResponse, return retval, err } -// The API also allows to check for the existance of a document using HEAD - +// Exists allows caller to check for the existance of a document using HEAD func Exists(pretty bool, index string, _type string, id string) (bool, error) { var url string - var response map[string]interface{} + var response map[string]interface{} if len(_type) > 0 { url = fmt.Sprintf("/%s/%s/%s?fields=_id%s", index, _type, id, api.Pretty(pretty)) @@ -61,20 +58,20 @@ func Exists(pretty bool, index string, _type string, id string) (bool, error) { url = fmt.Sprintf("/%s/%s?fields=_id%s", index, id, api.Pretty(pretty)) } - req, err := api.ElasticSearchRequest("HEAD", url) + req, err := api.ElasticSearchRequest("HEAD", url) if err != nil { fmt.Println(err) } - httpStatusCode, _, err := req.Do(&response) + httpStatusCode, _, err := req.Do(&response) if err != nil { return false, err } - if httpStatusCode == 404 { - return false, err - } else { - return true, err - } + if httpStatusCode == 404 { + return false, err + } else { + return true, err + } } diff --git a/core/index.go b/core/index.go index a2af0952..bfb78222 100644 --- a/core/index.go +++ b/core/index.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,7 +17,7 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The index API adds or updates a typed JSON document in a specific index, making it searchable. +// Index adds or updates a typed JSON document in a specific index, making it searchable. // http://www.elasticsearch.org/guide/reference/api/index_.html func Index(pretty bool, index string, _type string, id string, data interface{}) (api.BaseResponse, error) { var url string diff --git a/core/mget.go b/core/mget.go index c31fa150..1c0a2b47 100644 --- a/core/mget.go +++ b/core/mget.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,8 +17,8 @@ import ( "github.com/mattbaird/elastigo/api" ) -// Multi GET API allows to get multiple documents based on an index, type (optional) and id (and possibly routing). -// The response includes a docs array with all the fetched documents, each element similar in structure to a document +// MGet allows the caller to get multiple documents based on an index, type (optional) and id (and possibly routing). +// The response includes a docs array with all the fetched documents, each element similar in structure to a document // provided by the get API. // see http://www.elasticsearch.org/guide/reference/api/multi-get.html func MGet(pretty bool, index string, _type string, mgetRequest MGetRequestContainer) (MGetResponseContainer, error) { diff --git a/core/moreLikeThis.go b/core/moreLikeThis.go index 0155ba4c..1fbcdc25 100644 --- a/core/moreLikeThis.go +++ b/core/moreLikeThis.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,7 +17,7 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The more like this (mlt) API allows to get documents that are “like” a specified document. +// MoreLikeThis allows the caller to get documents that are “like” a specified document. // http://www.elasticsearch.org/guide/reference/api/more-like-this.html func MoreLikeThis(pretty bool, index string, _type string, id string, query MoreLikeThisQuery) (api.BaseResponse, error) { var url string diff --git a/core/msearch.go b/core/msearch.go index 15c366ba..05274467 100644 --- a/core/msearch.go +++ b/core/msearch.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core diff --git a/core/percolate.go b/core/percolate.go index 2bf51b59..a4cf38ce 100644 --- a/core/percolate.go +++ b/core/percolate.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,9 +17,9 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The percolator allows to register queries against an index, and then send percolate requests which include a doc, and +// RegisterPercolate allows the caller to register queries against an index, and then send percolate requests which include a doc, and // getting back the queries that match on that doc out of the set of registered queries. -// Think of it as the reverse operation of indexing and then searching. Instead of sending docs, indexing them, +// Think of it as the reverse operation of indexing and then searching. Instead of sending docs, indexing them, // and then running queries. One sends queries, registers them, and then sends docs and finds out which queries // match that doc. // see http://www.elasticsearch.org/guide/reference/api/percolate.html diff --git a/core/search.go b/core/search.go index b198a5a3..c54dfb5c 100644 --- a/core/search.go +++ b/core/search.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -25,7 +23,7 @@ var ( DebugRequests = false ) -// Performs a very basic search on an index via the request URI API. +// SearchRequest performs a very basic search on an index via the request URI API. // // params: // @pretty: bool for pretty reply or not, a parameter to elasticsearch @@ -61,7 +59,7 @@ func SearchRequest(pretty bool, index string, _type string, query interface{}, s return retval, err } -// Performs the simplest possible query in url string +// SearchUri performs the simplest possible query in url string // params: // @index: the elasticsearch index // @_type: optional ("" if not used) search specific type in this index diff --git a/core/search_test.go b/core/search_test.go index eafc4418..31605bad 100644 --- a/core/search_test.go +++ b/core/search_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( diff --git a/core/test_test.go b/core/test_test.go index 0634afe5..65025bd1 100644 --- a/core/test_test.go +++ b/core/test_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( diff --git a/core/update.go b/core/update.go index b3bf5fe4..8a490bc3 100644 --- a/core/update.go +++ b/core/update.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,11 +17,11 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The update API allows to update a document based on a script provided. The operation gets the document +// Update updates a document based on a script provided. The operation gets the document // (collocated with the shard) from the index, runs the script (with optional script language and parameters), -// and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure +// and index back the result (also allows to delete, or ignore the operation). It uses versioning to make sure // no updates have happened during the “get” and “reindex”. (available from 0.19 onwards). -// Note, this operation still means full reindex of the document, it just removes some network roundtrips +// Note, this operation still means full reindex of the document, it just removes some network roundtrips // and reduces chances of version conflicts between the get and the index. The _source field need to be enabled // for this feature to work. // diff --git a/core/validate.go b/core/validate.go index 6145de9e..0ce25031 100644 --- a/core/validate.go +++ b/core/validate.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package core import ( @@ -19,7 +17,7 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The validate API allows a user to validate a potentially expensive query without executing it. +// Validate allows a user to validate a potentially expensive query without executing it. // see http://www.elasticsearch.org/guide/reference/api/validate.html func Validate(pretty bool, index string, _type string, query string, explain bool) (api.BaseResponse, error) { var url string diff --git a/doc.go b/doc.go new file mode 100644 index 00000000..de41fcf5 --- /dev/null +++ b/doc.go @@ -0,0 +1,15 @@ +// Copyright 2012 Matthew Baird +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main \ No newline at end of file diff --git a/indices/aliases.go b/indices/aliases.go index ceef84e7..6b790382 100644 --- a/indices/aliases.go +++ b/indices/aliases.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -package indices \ No newline at end of file + +package indices diff --git a/indices/analyze.go b/indices/analyze.go index ceef84e7..c29f0b95 100644 --- a/indices/analyze.go +++ b/indices/analyze.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/clearCache.go b/indices/clearCache.go index ceef84e7..c29f0b95 100644 --- a/indices/clearCache.go +++ b/indices/clearCache.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/createIndex.go b/indices/createIndex.go index ceef84e7..c29f0b95 100644 --- a/indices/createIndex.go +++ b/indices/createIndex.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/deleteIndex.go b/indices/deleteIndex.go index ceef84e7..c29f0b95 100644 --- a/indices/deleteIndex.go +++ b/indices/deleteIndex.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/deleteMapping.go b/indices/deleteMapping.go index ceef84e7..c29f0b95 100644 --- a/indices/deleteMapping.go +++ b/indices/deleteMapping.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/doc.go b/indices/doc.go new file mode 100644 index 00000000..6b790382 --- /dev/null +++ b/indices/doc.go @@ -0,0 +1,12 @@ +// Copyright 2013 Matthew Baird +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package indices diff --git a/indices/flush.go b/indices/flush.go index 921ea4ee..e2c796ab 100644 --- a/indices/flush.go +++ b/indices/flush.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices import ( @@ -19,9 +17,9 @@ import ( "github.com/mattbaird/elastigo/api" ) -// The flush API allows to flush one or more indices through an API. The flush process of an index basically -// frees memory from the index by flushing data to the index storage and clearing the internal transaction -// log. By default, ElasticSearch uses memory heuristics in order to automatically trigger flush operations +// Flush flushes one or more indices through an API. The flush process of an index basically +// frees memory from the index by flushing data to the index storage and clearing the internal transaction +// log. By default, ElasticSearch uses memory heuristics in order to automatically trigger flush operations // as required in order to clear memory. // http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html // TODO: add Shards to response diff --git a/indices/getSettings.go b/indices/getSettings.go index ceef84e7..c29f0b95 100644 --- a/indices/getSettings.go +++ b/indices/getSettings.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/indicesExists.go b/indices/indicesExists.go index 328d0090..6b790382 100644 --- a/indices/indicesExists.go +++ b/indices/indicesExists.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices diff --git a/indices/openCloseIndex.go b/indices/openCloseIndex.go index ceef84e7..c29f0b95 100644 --- a/indices/openCloseIndex.go +++ b/indices/openCloseIndex.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/optimize.go b/indices/optimize.go index ceef84e7..c29f0b95 100644 --- a/indices/optimize.go +++ b/indices/optimize.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/putMapping.go b/indices/putMapping.go index ceef84e7..c29f0b95 100644 --- a/indices/putMapping.go +++ b/indices/putMapping.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/refresh.go b/indices/refresh.go index 410c18be..8f24c184 100644 --- a/indices/refresh.go +++ b/indices/refresh.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices import ( @@ -20,8 +18,8 @@ import ( "strings" ) -// The refresh API allows to explicitly refresh one or more index, making all operations performed since -// the last refresh available for search. The (near) real-time capabilities depend on the index engine used. +// Refresh explicitly refreshes one or more index, making all operations performed since +// the last refresh available for search. The (near) real-time capabilities depend on the index engine used. // For example, the robin one requires refresh to be called, but by default a refresh is scheduled periodically. // http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh.html // TODO: add Shards to response diff --git a/indices/segments.go b/indices/segments.go index ceef84e7..c29f0b95 100644 --- a/indices/segments.go +++ b/indices/segments.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/snapshot.go b/indices/snapshot.go index ceef84e7..c29f0b95 100644 --- a/indices/snapshot.go +++ b/indices/snapshot.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/stats.go b/indices/stats.go index ceef84e7..c29f0b95 100644 --- a/indices/stats.go +++ b/indices/stats.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/status.go b/indices/status.go index cebedeef..dc4937ae 100644 --- a/indices/status.go +++ b/indices/status.go @@ -1,11 +1,8 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +17,7 @@ import ( "strings" ) -// Lists status details of all indices or the specified index. +// Status lists status details of all indices or the specified index. // http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html func Status(pretty bool, indices ...string) (api.BaseResponse, error) { var retval api.BaseResponse diff --git a/indices/templates.go b/indices/templates.go index ceef84e7..c29f0b95 100644 --- a/indices/templates.go +++ b/indices/templates.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/indices/updateSettings.go b/indices/updateSettings.go index ceef84e7..c29f0b95 100644 --- a/indices/updateSettings.go +++ b/indices/updateSettings.go @@ -1,14 +1,12 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package indices \ No newline at end of file diff --git a/search/facet.go b/search/facet.go index 197ca88f..6aed41d6 100644 --- a/search/facet.go +++ b/search/facet.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( diff --git a/search/facet_test.go b/search/facet_test.go index f1aa0bd2..1bf9a9ff 100644 --- a/search/facet_test.go +++ b/search/facet_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( diff --git a/search/filter.go b/search/filter.go index 50e63b2a..35b39100 100644 --- a/search/filter.go +++ b/search/filter.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( @@ -46,7 +44,7 @@ func (f *FilterWrap) String() string { return fmt.Sprintf(`fopv: %d:%v`, len(f.filters), f.filters) } -// Custom marshalling to support the query dsl +// Custom marshalling to support the query dsl func (f *FilterWrap) addFilters(fl []interface{}) { if len(fl) > 1 { fc := fl[0] @@ -59,7 +57,7 @@ func (f *FilterWrap) addFilters(fl []interface{}) { f.filters = append(f.filters, fl...) } -// Custom marshalling to support the query dsl +// Custom marshalling to support the query dsl func (f *FilterWrap) MarshalJSON() ([]byte, error) { var root interface{} if len(f.filters) > 1 { @@ -100,8 +98,8 @@ func (f *FilterWrap) MarshalJSON() ([]byte, error) { "filter" : { "and" : [ { - "range" : { - "postDate" : { + "range" : { + "postDate" : { "from" : "2010-03-01", "to" : "2010-04-01" } @@ -118,10 +116,10 @@ func (f *FilterWrap) MarshalJSON() ([]byte, error) { // Filter Operation // // Filter().Term("user","kimchy") -// +// // // we use variadics to allow n arguments, first is the "field" rest are values // Filter().Terms("user", "kimchy", "elasticsearch") -// +// // Filter().Exists("repository.name") // func Filter() *FilterOp { @@ -155,7 +153,7 @@ func (f *FilterOp) Field(fld string) *FilterOp { // Filter Terms // // Filter().Terms("user","kimchy") -// +// // // we use variadics to allow n arguments, first is the "field" rest are values // Filter().Terms("user", "kimchy", "elasticsearch") // diff --git a/search/filter_test.go b/search/filter_test.go index 5a2c06b2..375f637a 100644 --- a/search/filter_test.go +++ b/search/filter_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( diff --git a/search/query.go b/search/query.go index f0b03889..98694878 100644 --- a/search/query.go +++ b/search/query.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( @@ -20,14 +18,14 @@ import ( "strings" ) -// Create a new Query Dsl +// QueryDsl creates a new Query Dsl func Query() *QueryDsl { return &QueryDsl{} } /* -some ways to serialize +some ways to serialize "query": { "filtered": { "query": { @@ -69,15 +67,15 @@ type QueryEmbed struct { //Exist string `json:"_exists_,omitempty"` } -// Custom marshalling to support the query dsl which is a conditional -// json format, not always the same parent/children +// MarshalJSON provides custom marshalling to support the query dsl which is a conditional +// json format, not always the same parent/children func (qd *QueryDsl) MarshalJSON() ([]byte, error) { q := qd.QueryEmbed hasQuery := false if q.Qs != nil || len(q.Terms) > 0 || q.MatchAll != nil { hasQuery = true } - // If a query has a + // If a query has a if qd.FilterVal != nil && hasQuery { queryB, err := json.Marshal(q) if err != nil { @@ -109,7 +107,7 @@ func (q *QueryDsl) Range(fop *FilterOp) *QueryDsl { return q } -// Add a term search for a specific field +// Add a term search for a specific field // Term("user","kimchy") func (q *QueryDsl) Term(name, value string) *QueryDsl { if len(q.Terms) == 0 { @@ -136,7 +134,7 @@ func (q *QueryDsl) Qs(qs *QueryString) *QueryDsl { // Fields in query_string search // Fields("fieldname","search_for","","") -// +// // Fields("fieldname,field2,field3","search_for","","") // // Fields("fieldname,field2,field3","search_for","field_exists","") @@ -155,7 +153,7 @@ func (q *QueryDsl) Fields(fields, search, exists, missing string) *QueryDsl { return q } -// Filter this query +// Filter this query func (q *QueryDsl) Filter(f *FilterOp) *QueryDsl { q.FilterVal = f return q @@ -170,7 +168,7 @@ type QueryWrap struct { Qs QueryString `json:"query_string,omitempty"` } -// QueryString based search +// QueryString based search func NewQueryString(field, query string) QueryString { return QueryString{"", field, query, "", "", nil} } diff --git a/search/search.go b/search/search.go index 6fbc73a5..4deec78c 100644 --- a/search/search.go +++ b/search/search.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( @@ -29,7 +27,7 @@ var ( _ = u.DEBUG ) -// This is the entry point to the SearchDsl, it is a chainable set of utilities +// Search is the entry point to the SearchDsl, it is a chainable set of utilities // to create searches. // // params @@ -90,7 +88,7 @@ func (s *SearchDsl) Pretty() *SearchDsl { return s } -// this is the elasticsearch *Type* within a specific index +// Type is the elasticsearch *Type* within a specific index func (s *SearchDsl) Type(indexType string) *SearchDsl { if len(s.types) == 0 { s.types = make([]string, 0) @@ -111,7 +109,7 @@ func (s *SearchDsl) From(from string) *SearchDsl { return s } -// This is a simple interfaceto search, doesn't have the power of query +// Search is a simple interface to search, doesn't have the power of query // but uses a simple query_string search func (s *SearchDsl) Search(srch string) *SearchDsl { s.QueryVal = Query().Search(srch) @@ -123,7 +121,7 @@ func (s *SearchDsl) Size(size string) *SearchDsl { return s } -// Pass a Query expression to this search +// Facet passes a Query expression to this search // // qry := Search("github").Size("0").Facet( // Facet().Regex("repository.name", "no.*").Size("8"), @@ -142,7 +140,7 @@ func (s *SearchDsl) Query(q *QueryDsl) *SearchDsl { return s } -// Add Filter Clause with optional Boolean Clause. This accepts n number of +// Filter adds a Filter Clause with optional Boolean Clause. This accepts n number of // filter clauses. If more than one, and missing Boolean Clause it assumes "and" // // qry := Search("github").Filter( diff --git a/search/search_test.go b/search/search_test.go index ad31d886..3dfe96a2 100644 --- a/search/search_test.go +++ b/search/search_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( diff --git a/search/sort.go b/search/sort.go index 6d6e2086..3505d8d3 100644 --- a/search/sort.go +++ b/search/sort.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( @@ -18,7 +16,7 @@ import ( "fmt" ) -// Sorting accepts any number of Sort commands +// SortDsl accepts any number of Sort commands // // Query().Sort( // Sort("last_name").Desc(), diff --git a/search/test_test.go b/search/test_test.go index 442ef02e..a9ebfd62 100644 --- a/search/test_test.go +++ b/search/test_test.go @@ -1,16 +1,14 @@ -// Copyright 2012 Matthew Baird -// +// Copyright 2013 Matthew Baird // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at -// // http://www.apache.org/licenses/LICENSE-2.0 -// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package search import ( diff --git a/tutorial/start_1.go b/tutorial/start_1.go index cd5de7ae..2d29ce5b 100644 --- a/tutorial/start_1.go +++ b/tutorial/start_1.go @@ -1,3 +1,14 @@ +// Copyright 2013 Matthew Baird +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import (