2017-06-05 79 views

回答

1

無法將multi_fields與屬性映射相加;爲此,您需要使用fluent mapping

void Main() 
{ 
    var client = new ElasticClient(); 

    client.CreateIndex("index-name", c => c 
     .Mappings(m => m 
      .Map<Test>(mm => mm 
       .AutoMap() 
       .Properties(p => p 
        .Text(t => t 
         .Name(n => n.Data) 
         .Boost(2) 
         .Fields(ff => ff 
          .Text(tt => tt 
           .Name("raw") 
          ) 
         ) 
        ) 
       ) 
      ) 
     ) 
    ); 
} 

public class Test 
{ 
    public string Data { get; set; } 
}