Skip to content

Commit

Permalink
Add tests for DynamicMappings
Browse files Browse the repository at this point in the history
  • Loading branch information
svipy9 committed Feb 24, 2016
1 parent f6f4105 commit c3eb282
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/indicesputmapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
33 changes: 32 additions & 1 deletion lib/indicesputmapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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",
},
},
},
}
*/

Expand Down Expand Up @@ -229,7 +249,18 @@ func TestPutMappingFromJSON(t *testing.T) {
}
}
}
}
},
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}`

Expand Down

0 comments on commit c3eb282

Please sign in to comment.