【发布时间】:2020-10-27 09:08:09
【问题描述】:
基本上我想重写这段代码:
var values = "{\"source\":{\"index\": \"" + oldIndex.Index + "\",\"type\": \"" + MyType+ "\"},"
+ "\",\"size\": \"" + size + "\"},"
+ "\"dest\": {\"index\": \"" + tempIndex + "\",\"type\": \"_doc\"}}";
var result = this.httpClient.PostAsync(ReIndexUrl, new StringContent(values, System.Text.Encoding.UTF8, "application/json")).Result;
var response = result.Content.ReadAsStringAsync().Result;
到 NEST 客户端:
var response = elasticClient.ReindexOnServer(
r => r
.Source(
s => s
.Index(sourceIndex)
)
.Destination(
d => d
.Index(targetIndex)
).Refresh(false).Size(maximumDocuments)
.WaitForCompletion()
);
在使用 NEST 版本将文档从 V6 重新索引到 V7 时,由于目标上的重复类型而出现错误:
java.lang.IllegalArgumentException: Rejecting mapping update to [audit-trail-2020-04-temp] as the final mapping would have more than 1 type: [_doc, audittrailentry]
由于无法排除类型,我找不到使用 NEST 解决此问题的方法?
【问题讨论】:
-
你好,你有没有找到答案?我遇到了几乎完全相同的问题,并且在任何地方都看不到 NEST API 允许覆盖目标索引映射类型。
-
检查我的答案
标签: elasticsearch nest