Elasticsearch Nest中的映射方法结果

时间:2018-09-19 08:37:32

标签: c# elasticsearch nest

我的模型上有一个子类PersonName。

public class PersonName
{
    public string Prefix { get; set;  }
    public string FirstName { get; set; }
    public string MiddleNames { get; set; }
    public string LastName { get; set; }
    public string Suffix { get; set; }

    public string GetFullName() => StringExtensions.ConcatNonEmpty(" ", FirstName, LastName);
}

我想索引GetFullName的结果。

.Object<PersonName>(o => o
   .Name(n => n.Name)
   .AutoMap()
   .Properties(p => p
      .Text(t => t
         .Name(n2 => n2.FirstName)
         .Analyzer(Ananlysis.AutocompleteAnalyzerName)
         .SearchAnalyzer("standard")
       ).Text(t => t
          .Name(n2 => n2.MiddleNames)
          .Analyzer(Ananlysis.AutocompleteAnalyzerName)
          .SearchAnalyzer("standard")
       ).Text(t => t
          .Name(n2 => n2.LastName)
          .Analyzer(Ananlysis.AutocompleteAnalyzerName)
          .SearchAnalyzer("standard")
       )
       // Here is what I'd like to do
       .Text(t => t
          .Name("name.full")
          .Value(v => v.GetFullName())) // <--- something like this
    ) 
  )
)

有什么办法吗?

0 个答案:

没有答案