Skip to content

CreateIndex with Attachment will fail #1826

@kyakhta

Description

@kyakhta
 client.CreateIndex(Index, c => c
                .Mappings(m => m.Map<Docx>(p => p
                .Properties(ps => ps.Attachment(a => a.FileField(t => t.Name(e => e.Foo))))
                    .Properties(ps => ps.String(s => s.Name(o => o.Title))))));

will fail on a => a.FileField(t => t.Name(e => e.Foo) because AttachmentPropertyDescriptor.Dictionary is not initialized and has null value:

private AttachmentPropertyDescriptor<T> SetMetadataField<TDescriptor, TInterface>(Func<TDescriptor, TInterface> selector, string fieldName)
            where TDescriptor : TInterface, new()
            where TInterface : IProperty
        {
            selector.ThrowIfNull(nameof(selector));
            var type = selector(new TDescriptor());
            **this.Dictionary[fieldName] = type;**
            return this;
        }

Metadata

Metadata

Assignees

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