Skip to content

NullReference in DateMappingDescriptor #990

Closed
@ThomasVer

Description

@ThomasVer

When trying to add a field to a date mapping in a DynamicTemplate, I keep getting a NullReference.
See below for a snippet of my code:

.DynamicTemplates(d => d
                        .Add(dt => dt
                            .Name("date_template")
                            .Match("*_date")
                            .MatchMappingType("date")
                            .Mapping(mp => mp
                                .Date(date => date
                                    .Format("basic_date || date|| yyyy/MM/dd || dd/MM/yyyy || dd-MM-yyyy || MM/dd/yyyy || MM-dd-yyyy")
                                    .Fields(f => f
                                        .String(fs => fs
                                            .Name("raw")
                                            .Analyzer("number_delimiter")
                                        )
                                    )
                                )
                            )
                        )

Error is encountered on this line:

[NullReferenceException: Object reference not set to an instance of an object.]
   Nest.DateMappingDescriptor`1.Fields(Func`2 fieldSelector) in c:\Users\gmarz\code\elasticsearch-net\src\Nest\Domain\Mapping\Descriptors\DateMappingDescriptor.cs:87

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