Skip to content

AutoMap maxRecursion is ignored #1821

Closed
@MikeHarnetty

Description

@MikeHarnetty

Hello

I'm using attributes to map properties, and since one of the types I want to map contains itself I'm calling AutoMap with the maxRecursion parameter set to a depth I'd like to recurse to:

client.Map<T>(m => m.Index("index_name").AutoMap(maxRecursion))

However this doesn't seem to have any effect.

I dug into AutoMap a little and it appears that parameter is never actually used here when creating the PropertyWalker:

public PutMappingDescriptor<T> AutoMap(IPropertyVisitor visitor = null, int maxRecursion = 0) => Assign(a =>
        {
            a.Properties = a.Properties ?? new Properties();
            var autoProperties = new PropertyWalker(typeof(T), visitor).GetProperties();
            foreach (var autoProperty in autoProperties)
                a.Properties[autoProperty.Key] = autoProperty.Value;
        });

Cheers
Mike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions