Skip to content

Commit

Permalink
this compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Shute committed Jun 19, 2014
1 parent 0c98885 commit 3f9f264
Show file tree
Hide file tree
Showing 83 changed files with 629 additions and 857 deletions.
10 changes: 5 additions & 5 deletions HACKING.md
Expand Up @@ -4,18 +4,18 @@ Testing

To run tests, this library loads data into an elasticsearch server and tests against that.

See core/test_test.go. The data set should remain the same as it pulls a known set of github archive data.
See api/coretest_test.go. The data set should remain the same as it pulls a known set of github archive data.

usage:

$cd core
$cd core

$go test -v -host eshost -loaddata # load the data

$go test -v -host eshost # without load data, which only needs to run once

Clean out the Elasticsearch index:

http -v DELETE http://localhost:9200/github
or
curl -XDELETE http://localhost:9200/github
235 changes: 0 additions & 235 deletions api/request.go

This file was deleted.

33 changes: 15 additions & 18 deletions client.go
Expand Up @@ -16,10 +16,7 @@ package main
import (
"encoding/json"
"flag"
"github.com/mattbaird/elastigo/api"
"github.com/mattbaird/elastigo/cluster"
"github.com/mattbaird/elastigo/core"
"github.com/mattbaird/elastigo/indices"
elastigo "github.com/shutej/elastigo/lib"
"log"
"time"
)
Expand All @@ -32,12 +29,13 @@ var (
func main() {
flag.Parse()
log.SetFlags(log.Ltime | log.Lshortfile)
api.Domain = *eshost
core.VerboseLogging = true
response, _ := core.Index("twitter", "tweet", "1", nil, NewTweet("kimchy", "Search is cool"))
indices.Flush()

c := elastigo.NewConnection()
c.Domain = *eshost
response, _ := c.Index("twitter", "tweet", "1", nil, NewTweet("kimchy", "Search is cool"))
c.Flush()
log.Printf("Index OK: %v", response.Ok)
searchresponse, err := core.SearchRequest("twitter", "tweet", nil, "{\"query\" : {\"term\" : { \"user\" : \"kimchy\" }}}")
searchresponse, err := c.Search("twitter", "tweet", nil, "{\"query\" : {\"term\" : { \"user\" : \"kimchy\" }}}")
if err != nil {
log.Println("error during search:" + err.Error())
log.Fatal(err)
Expand All @@ -50,23 +48,22 @@ func main() {
}
json.Unmarshal(bytes, t)
log.Printf("Search Found: %s", t)
response, _ = core.Get("twitter", "tweet", "1", nil)
response, _ = c.Get("twitter", "tweet", "1", nil)
log.Printf("Get: %v", response.Exists)
exists, _ := core.Exists("twitter", "tweet", "1", nil)
exists, _ := c.Exists("twitter", "tweet", "1", nil)
log.Printf("Exists: %v", exists)
indices.Flush()
countResponse, _ := core.Count("twitter", "tweet", nil)
c.Flush()
countResponse, _ := c.Count("twitter", "tweet", nil)
log.Printf("Count: %v", countResponse.Count)
response, _ = core.Delete("twitter", "tweet", "1", map[string]interface{}{"version": -1, "routing": ""})
response, _ = c.Delete("twitter", "tweet", "1", map[string]interface{}{"version": -1, "routing": ""})
log.Printf("Delete OK: %v", response.Ok)
response, _ = core.Get("twitter", "tweet", "1", nil)
response, _ = c.Get("twitter", "tweet", "1", nil)
log.Printf("Get: %v", response.Exists)

healthResponse, _ := cluster.Health()
healthResponse, _ := c.Health()
log.Printf("Health: %v", healthResponse.Status)

cluster.UpdateSettings("transient", "discovery.zen.minimum_master_nodes", 2)

c.UpdateSettings("transient", "discovery.zen.minimum_master_nodes", 2)
}

// used in test suite, chosen to be similar to the documentation
Expand Down

0 comments on commit 3f9f264

Please sign in to comment.