@@ -266,7 +266,7 @@ component accessors="true" threadSafe singleton {
266
266
}
267
267
}
268
268
269
-
269
+
270
270
271
271
/**
272
272
* Returns the mappings for an index
@@ -278,25 +278,30 @@ component accessors="true" threadSafe singleton {
278
278
var path = arguments .indexName & " /_mapping" ;
279
279
if ( ! isNull ( arguments .field ) ){
280
280
path & = " /field/" & arguments .field ;
281
+ } else if ( findNoCase ( " *" , arguments .indexName ) ){
282
+ // if a wild card is present we are only interested in the fields
283
+ arguments .field = " *" ;
284
+ path & = " /field/" & arguments .field ;
281
285
}
282
286
var response = variables .nodePool .newRequest ( path , " GET" ).send ();
283
287
284
288
if ( response .getStatusCode () ! = 200 ) {
285
289
onResponseFailure ( response );
286
290
} else {
291
+ var mappings = response .json ();
287
292
return isNull ( arguments .field )
288
- ? response . json () [ indexName ].mappings
289
- : response . json () .reduce ( ( acc , indexKey , value ) = > {
290
- value .mappings .keyArray ().each ( ( mappingKey ) = > {
291
- if ( ! acc .keyExists ( mappingKey ) ){
292
- acc [ mappingKey ] = value .mappings [ mappingKey ];
293
- acc [ mappingKey ][" indices" ] = [ indexKey ];
294
- } else {
295
- acc [ mappingKey ][" indices" ].append ( indexKey );
296
- }
297
- } );
298
- return acc ;
299
- }, {} );
293
+ ? mappings [ indexName ].mappings
294
+ : mappings .reduce ( ( acc , indexKey , value ) = > {
295
+ value .mappings .keyArray ().each ( ( mappingKey ) = > {
296
+ if ( ! acc .keyExists ( mappingKey ) ){
297
+ acc [ mappingKey ] = value .mappings [ mappingKey ];
298
+ acc [ mappingKey ][" indices" ] = [ indexKey ];
299
+ } else {
300
+ acc [ mappingKey ][" indices" ].append ( indexKey );
301
+ }
302
+ } );
303
+ return acc ;
304
+ }, {} );
300
305
}
301
306
}
302
307
0 commit comments