Proper way to do multi field with NEST

后端 未结 1 927
别跟我提以往
别跟我提以往 2021-02-14 23:41

I want to implement full text search and tokenized search with NEST, so I want to get multifield like that :

     \"tweet\": {
        \"properties\": {
                 


        
相关标签:
1条回答
  • 2021-02-15 00:02

    Checkout this answer.

    Basically, you could do something like this:

    client.CreatIndex("tweets", c => c
        .AddMapping<Tweet>(m => m
            .MapFromAttributes()
            .Properties(props => props
                .MultiField(mf => mf
                    .Name(t => t.Message)
                    .Fields(fs => fs
                        .String(s => s.Name(t => t.Message).Analyzer("standard"))
                        .String(s => s.Name(t => t.Message.Suffix("raw")).Index(FieldIndexOption.not_analyzed)))))));
    
    0 讨论(0)
提交回复
热议问题