summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go30
1 files changed, 20 insertions, 10 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go b/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go
index ffac0d0f2..644e1187a 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/indices_put_mapping_test.go
@@ -19,18 +19,18 @@ func TestPutMappingURL(t *testing.T) {
}{
{
[]string{},
- "tweet",
- "/_mapping/tweet",
+ "doc",
+ "/_mapping/doc",
},
{
[]string{"*"},
- "tweet",
- "/%2A/_mapping/tweet",
+ "doc",
+ "/%2A/_mapping/doc",
},
{
[]string{"store-1", "store-2"},
- "tweet",
- "/store-1%2Cstore-2/_mapping/tweet",
+ "doc",
+ "/store-1%2Cstore-2/_mapping/doc",
},
}
@@ -47,9 +47,19 @@ func TestPutMappingURL(t *testing.T) {
func TestMappingLifecycle(t *testing.T) {
client := setupTestClientAndCreateIndex(t)
+ //client := setupTestClientAndCreateIndexAndLog(t)
+
+ // Create index
+ createIndex, err := client.CreateIndex(testIndexName3).Do(context.TODO())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if createIndex == nil {
+ t.Errorf("expected result to be != nil; got: %v", createIndex)
+ }
mapping := `{
- "tweetdoc":{
+ "doc":{
"properties":{
"field":{
"type":"keyword"
@@ -58,7 +68,7 @@ func TestMappingLifecycle(t *testing.T) {
}
}`
- putresp, err := client.PutMapping().Index(testIndexName2).Type("tweetdoc").BodyString(mapping).Do(context.TODO())
+ putresp, err := client.PutMapping().Index(testIndexName3).Type("doc").BodyString(mapping).Do(context.TODO())
if err != nil {
t.Fatalf("expected put mapping to succeed; got: %v", err)
}
@@ -69,14 +79,14 @@ func TestMappingLifecycle(t *testing.T) {
t.Fatalf("expected put mapping ack; got: %v", putresp.Acknowledged)
}
- getresp, err := client.GetMapping().Index(testIndexName2).Type("tweetdoc").Do(context.TODO())
+ getresp, err := client.GetMapping().Index(testIndexName3).Type("doc").Do(context.TODO())
if err != nil {
t.Fatalf("expected get mapping to succeed; got: %v", err)
}
if getresp == nil {
t.Fatalf("expected get mapping response; got: %v", getresp)
}
- props, ok := getresp[testIndexName2]
+ props, ok := getresp[testIndexName3]
if !ok {
t.Fatalf("expected JSON root to be of type map[string]interface{}; got: %#v", props)
}