From c3eb282ce7729f25568c6887ff500ef5fe105980 Mon Sep 17 00:00:00 2001
From: Pavel Sviridov
Date: Wed, 24 Feb 2016 20:29:59 +0600
Subject: [PATCH] Add tests for DynamicMappings
---
lib/indicesputmapping.go | 1 +
lib/indicesputmapping_test.go | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/lib/indicesputmapping.go b/lib/indicesputmapping.go
index 649eb260..d0c01d4b 100644
--- a/lib/indicesputmapping.go
+++ b/lib/indicesputmapping.go
@@ -28,6 +28,7 @@ type MappingOptions struct {
Routing *RoutingOptions `json:"_routing,omitempty"`
Size *SizeOptions `json:"_size,omitempty"`
Source *SourceOptions `json:"_source,omitempty"`
+ TTL *TTLOptions `json:"_ttl,omitempty"`
Type *TypeOptions `json:"_type,omitempty"`
Properties map[string]interface{} `json:"properties"`
DynamicTemplates []map[string]interface{} `json:"dynamic_templates,omitempty"`
diff --git a/lib/indicesputmapping_test.go b/lib/indicesputmapping_test.go
index 8da3ca34..0a1c152e 100644
--- a/lib/indicesputmapping_test.go
+++ b/lib/indicesputmapping_test.go
@@ -110,6 +110,17 @@ func TestPutMapping(t *testing.T) {
},
},
},
+ DynamicTemplates: []map[string]interface{}{
+ map[string]interface{}{
+ "strings": map[string]interface{}{
+ "match_mapping_type": "string",
+ "mapping": map[string]interface{}{
+ "type": "string",
+ "index": "not_analyzed",
+ },
+ },
+ },
+ },
}
expValue := MappingForType("myType", MappingOptions{
Timestamp: TimestampOptions{Enabled: true},
@@ -196,6 +207,15 @@ func TestPutMappingFromJSON(t *testing.T) {
},
},
},
+ DynamicTemplates: []map[string]interface{}{
+ "strings": map[string]interface{}{
+ "match_mapping_type": "string",
+ "mapping": {
+ "type": "string",
+ "index": "not_analyzed",
+ },
+ },
+ },
}
*/
@@ -229,7 +249,18 @@ func TestPutMappingFromJSON(t *testing.T) {
}
}
}
- }
+ },
+ "dynamic_templates": [
+ {
+ "strings": {
+ "match_mapping_type": "string",
+ "mapping": {
+ "type": "string",
+ "index": "not_analyzed"
+ }
+ }
+ }
+ ]
}
}`