2

Elasticsearch 2.3.3 と Nest 2.3.2 を使用しています。インデックスを作成する必要があります。クラス ファイルに追加された属性を使用してプロパティをマップする必要があります。

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; }

}

また、ファイルフィールドに補完候補を追加したいと思います。私はこの弾力的な検索に慣れていません。誰でも助けてもらえますか?

以下のように添付ファイルのインデックスを作成しました。これに補完提案とステマーコードを追加する方法は?

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))
                               )))));
4

0 に答える 0