我一直在尝试使用批量插入功能,但每次使用它都会显示一些映射错误。批量插入函数声明是否已从嵌套 1.x 更改为嵌套 5.x,因为在 5.x 嵌套文档中我没有找到 .bulk() 函数。请建议
批量插入代码:
public void bulkInsert(List<BaseData> recordList, List<String> listOfIndexName)
{
BulkDescriptor descriptor = new BulkDescriptor();
descriptor.Index<BaseData>(op => op
.Document(recordList[j])
.Index(listOfIndexName[j])
);
}
var result = clientConnection.Bulk(descriptor);
}
我传递的数据列表如下所示:
[ElasticsearchType(IdProperty = "number")]
class TicketData : BaseData
{
//[ElasticProperty(Index = FieldIndexOption.NotAnalyzed, Store = true)]
[Date(Name = "sys_updated_on", Store = true)]
public DateTimeOffset sys_updated_on { get; set; }
[Text(Name = "number", Store = true)]
public override string number { get; set; }
[Text(Name = "incident_state", Store = true)]
public string incident_state { get; set; }
[Text(Name = "location", Store = true)]
public string location { get; set; }
[Text(Name = "assigned_to", Store = true)]
public string assigned_to { get; set; }
[Text(Name = "u_knowledge_id", Store = true)]
public string u_knowledge_id { get; set; }
[Text(Name = "u_knowledge_id.u_process_role", Store = true)]
public string u_knowledge_id_u_process_role { get; set; }
}