将对象属性字段copy_to到主文档字段

时间:2017-05-19 09:43:49

标签: c# elasticsearch nest

我的模特是:

class Entity
{
   public List<Prop> PropList { get; set; }

   public List<string> Props { get; set; }

   // others
}

class Prop
{
  public string Name { get; set; }
  public List<string> Tags { get; set; }
}

我想将Prop's.Names中的所有PropList复制到List<string> Props,以便将它们包含在_source中。

弹性搜索copy_to可以吗?

我尝试了以下,但没有用,

.Mappings(des => des
   .AutoMap()
   .Properties(propsDes => propsDes
      .Object<Prop>(objDes => objDes
        .Name(propDes => propDes.PropList)
        .AutoMap()
        .Properties(objPropsDes => objPropsDes
           .Text(s => s
              .Name(e => e.Name)
              .CopyTo(fieldDes => fieldDes.Field("props"))
           )
         )
      )
    )
  )

0 个答案:

没有答案
相关问题