@@ -98,10 +98,9 @@ private void parseFieldMappings(Class<?> clazz, Map<String, Object> classDefinit
98
98
99
99
private void processComplexOrArray (Class <?> clazz , List <IFacetBuilderHelper > facetFields , List <IFilterBuilderHelper > filteredFields , String pathPrefix ,
100
100
Map <String , Object > propertiesDefinitionMap , Indexable indexable ) {
101
- Class <?> arrayType = indexable .getComponentType ();
102
- Class <?> mapValueType = indexable .getComponentType (1 );
103
101
// mapping of a complex field
104
- if (arrayType != null && mapValueType == null ) {
102
+ if (indexable .isArrayOrCollection ()) {
103
+ Class <?> arrayType = indexable .getComponentType ();
105
104
// process the array type.
106
105
if (ClassUtils .isPrimitiveOrWrapper (arrayType ) || arrayType == String .class || indexable .getType () == Date .class ) {
107
106
processStringOrPrimitive (clazz , propertiesDefinitionMap , pathPrefix , indexable );
@@ -319,19 +318,22 @@ private void processComplexType(Class<?> clazz, Map<String, Object> propertiesDe
319
318
List <IFilterBuilderHelper > filters , List <IFacetBuilderHelper > facets ) {
320
319
NestedObjectFieldAnnotationParser nested = new NestedObjectFieldAnnotationParser (this , filters , facets );
321
320
processFieldAnnotation (NestedObject .class , nested , propertiesDefinitionMap , pathPrefix , indexable );
322
- ObjectFieldAnnotationParser objectFieldAnnotationParser = new ObjectFieldAnnotationParser (this , filters , facets );
323
- processFieldAnnotation (ObjectField .class , objectFieldAnnotationParser , propertiesDefinitionMap , pathPrefix , indexable );
324
- // by default we consider the complex object as an object mapping and process recursive mapping of every field just as ES would process based on dynamic
325
- // mapping
326
321
327
322
if (propertiesDefinitionMap .get (indexable .getName ()) == null ) {
328
- // Define mapping as object
329
- Map <String , Object > fieldDefinition = (Map <String , Object >) propertiesDefinitionMap .get (indexable .getName ());
330
- if (fieldDefinition == null ) {
331
- fieldDefinition = new HashMap <String , Object >();
332
- propertiesDefinitionMap .put (indexable .getName (), fieldDefinition );
323
+ ObjectFieldAnnotationParser objectFieldAnnotationParser = new ObjectFieldAnnotationParser (this , filters , facets );
324
+ processFieldAnnotation (ObjectField .class , objectFieldAnnotationParser , propertiesDefinitionMap , pathPrefix , indexable );
325
+ // by default we consider the complex object as an object mapping and process recursive mapping of every field just as ES would process based on
326
+ // dynamic
327
+ // mapping
328
+ if (propertiesDefinitionMap .get (indexable .getName ()) == null ) {
329
+ // Define mapping as object
330
+ Map <String , Object > fieldDefinition = (Map <String , Object >) propertiesDefinitionMap .get (indexable .getName ());
331
+ if (fieldDefinition == null ) {
332
+ fieldDefinition = new HashMap <String , Object >();
333
+ propertiesDefinitionMap .put (indexable .getName (), fieldDefinition );
334
+ }
335
+ objectFieldAnnotationParser .parseAnnotation (null , fieldDefinition , pathPrefix , indexable );
333
336
}
334
- objectFieldAnnotationParser .parseAnnotation (null , fieldDefinition , pathPrefix , indexable );
335
337
}
336
338
}
337
339
0 commit comments