我的模特是:
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"))
)
)
)
)
)