File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,10 @@ func transformImportedField(fd FieldDefinition) common.MapStr {
229229 m ["description" ] = fd .Description
230230 }
231231
232+ if fd .Pattern != "" {
233+ m ["pattern" ] = fd .Pattern
234+ }
235+
232236 if fd .Index != nil {
233237 m ["index" ] = * fd .Index
234238 }
Original file line number Diff line number Diff line change @@ -160,6 +160,25 @@ func TestDependencyManagerInjectExternalFields(t *testing.T) {
160160 changed : true ,
161161 valid : true ,
162162 },
163+ {
164+ title : "external with pattern" ,
165+ defs : []common.MapStr {
166+ {
167+ "name" : "source.mac" ,
168+ "external" : "test" ,
169+ },
170+ },
171+ result : []common.MapStr {
172+ {
173+ "name" : "source.mac" ,
174+ "type" : "keyword" ,
175+ "description" : "MAC address of the source." ,
176+ "pattern" : "^[A-F0-9]{2}(-[A-F0-9]{2}){5,}$" ,
177+ },
178+ },
179+ changed : true ,
180+ valid : true ,
181+ },
163182 {
164183 title : "override not indexed external" ,
165184 defs : []common.MapStr {
@@ -228,6 +247,12 @@ func TestDependencyManagerInjectExternalFields(t *testing.T) {
228247 Index : & indexFalse ,
229248 DocValues : & indexFalse ,
230249 },
250+ {
251+ Name : "source.mac" ,
252+ Description : "MAC address of the source." ,
253+ Pattern : "^[A-F0-9]{2}(-[A-F0-9]{2}){5,}$" ,
254+ Type : "keyword" ,
255+ },
231256 }}
232257 dm := & DependencyManager {schema : schema }
233258
You can’t perform that action at this time.
0 commit comments