I am using elasticsearc 2.3.3 and Nest 2.3.2, I need to create index. Need to map the properties with attributes added in the class file.
public class IndexDocument
{
[Number(Store = true)]
public long Id { get; set; }
[String(Store = true, Index = FieldIndexOption.Analyzed, TermVector = TermVectorOption.WithPositionsOffsets)]
public string Title { get; set; }
public Attachment File { get; set; }
[String(Store = true, Index = FieldIndexOption.Analyzed)]
public string DocumentType { get; set; }
[String(Store = true, Index = FieldIndexOption.NotAnalyzed)]
public string DocLocation { get; set; }
[String(Store = true, Index = FieldIndexOption.Analyzed)]
public DateTime LastModifiedDate { get; set; }
}
public class Attachment
{
public Attachment()
{
}
[String(Name = "_content_length", Store = true, Index = FieldIndexOption.Analyzed)]
public long ContentLength { get; set; }
[String(Store = true, Index = FieldIndexOption.Analyzed, TermVector = TermVectorOption.WithPositionsOffsets, Name = "_content")]
public string Content { get; set; }
}
Also I would like to add a completion suggest to the File field. I am new in this elastic search. Can anyone please help?
I have created my attachment index as below. How to append completion suggest and stemmer code with this?
this.client.CreateIndex("mydocs", c => c.Mappings(mp => mp.Map<IndexDocument>
(m => m.Properties(ps => ps.Attachment
(a => a.Name(o => o.File)
.TitleField(t => t.Name(x => x.Title).TermVector(TermVectorOption.WithPositionsOffsets))
)))));