Skip to content

Commit

Permalink
Newlines. Adding delete index
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Wang committed Sep 26, 2013
1 parent 91a0bc6 commit 0fc107d
Show file tree
Hide file tree
Showing 60 changed files with 234 additions and 113 deletions.
4 changes: 3 additions & 1 deletion api/baseRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package api


import (
//"bytes"
"encoding/json"
Expand Down
6 changes: 4 additions & 2 deletions api/baseResponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
// 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.
// limitations under the license.

package api


import (
"fmt"
)
)

type BaseResponse struct {
Ok bool `json:"ok"`
Expand Down
4 changes: 3 additions & 1 deletion api/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package api


import (
"bytes"
"encoding/json"
Expand Down
4 changes: 3 additions & 1 deletion api/searchdsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package api


type SearchRequest struct {
From int `json:"from,omitempty"`
Size int `json:"size,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion api/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package api


type Query struct {
Query Term `json:"query"`
}
Expand Down
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package main


import (
"encoding/json"
"flag"
Expand Down
6 changes: 4 additions & 2 deletions cluster/clusterReroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package cluster


import (
"encoding/json"
"errors"
Expand All @@ -23,7 +25,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
Expand Down
6 changes: 4 additions & 2 deletions cluster/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package cluster


import (
"encoding/json"
"fmt"
Expand All @@ -23,7 +25,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
Expand Down
5 changes: 3 additions & 2 deletions cluster/nodesHotThreads.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
// 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
// limitations under the license.

package cluster
4 changes: 3 additions & 1 deletion cluster/nodesInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// 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.
// limitations under the license.

package cluster


5 changes: 3 additions & 2 deletions cluster/nodesShutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
// 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
// limitations under the license.

package cluster
4 changes: 3 additions & 1 deletion cluster/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package cluster


import (
"github.com/mattbaird/elastigo/api"
)
Expand Down
5 changes: 3 additions & 2 deletions cluster/updateSettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
// 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
// limitations under the license.

package cluster
4 changes: 3 additions & 1 deletion core/bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core


import (
"bytes"
"encoding/json"
Expand Down
4 changes: 3 additions & 1 deletion core/bulkUDP.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
// 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.
// limitations under the license.

package core

4 changes: 3 additions & 1 deletion core/bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core


import (
"bytes"
"crypto/rand"
Expand Down
12 changes: 7 additions & 5 deletions core/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
Expand All @@ -24,12 +26,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,
// 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.
// 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
Expand Down
6 changes: 4 additions & 2 deletions core/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
"github.com/mattbaird/elastigo/api"
)

// The delete API allows to delete a typed JSON document from a specific index based on its id.
// The delete API allows to delete a typed JSON document from a specific index based on its id.
// http://www.elasticsearch.org/guide/reference/api/delete.html
// todo: add routing and versioning support
func Delete(pretty bool, index string, _type string, id string, version int, routing string) (api.BaseResponse, error) {
Expand Down
8 changes: 5 additions & 3 deletions core/deleteByQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
"github.com/mattbaird/elastigo/api"
"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
// 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
// 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) {
Expand Down
4 changes: 3 additions & 1 deletion core/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core_test


import (
"bytes"
"fmt"
Expand Down
8 changes: 5 additions & 3 deletions core/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
"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.
// 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.
// 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) {
Expand Down
4 changes: 3 additions & 1 deletion core/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
Expand Down
4 changes: 3 additions & 1 deletion core/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
Expand Down
6 changes: 4 additions & 2 deletions core/mget.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
"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
// 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) {
Expand Down
6 changes: 4 additions & 2 deletions core/moreLikeThis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
// 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.
// limitations under the license.

package core


import (
"encoding/json"
"fmt"
"github.com/mattbaird/elastigo/api"
)

// The more like this (mlt) API allows to get documents that are “like” a specified document.
// The more like this (mlt) API allows 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
Expand Down
Loading

0 comments on commit 0fc107d

Please sign in to comment.