真人照片转二次元后怎么换画风?原照与二次元成图的两种用法
2026-11-21
2026-11-26 0
收到 Elasticsearch 的重建索引错误时,先保存响应中的 failures、created 和 version_conflicts。用 wait_for_completion=false 提交后,可到 Kibana Dev Tools 的 Console 执行 GET _tasks/任务ID 查看进度,结束后再读最终响应或任务错误。中途失败时先验证目标实际写入量,再选择恢复方式。
在空测试环境创建两条订单。源端将金额映射为 keyword,允许保存数字字符串与待定状态。目标改用整数后,观察两条记录分别如何处理。
PUT orders-demo-v1
{"settings":{"number_of_replicas":0},"mappings":{"properties":{"amount":{"type":"keyword"}}}}
PUT orders-demo-v1/_doc/1?refresh=true
{"amount":"120"}
PUT orders-demo-v1/_doc/2?refresh=true
{"amount":"pending"}
PUT orders-demo-check
{"settings":{"number_of_replicas":0},"mappings":{"properties":{"amount":{"type":"integer"}}}}只迁移这两个 ID。诊断目标单独命名,便于对照写入前后的状态。
POST _reindex?refresh=true
{
"source":{"index":"orders-demo-v1","query":{"ids":{"values":["1","2"]}}},
"dest":{"index":"orders-demo-check","op_type":"create"}
}在 Elasticsearch 8.19.0 本地实测,响应为 HTTP 400,created 为 1,失败文档 ID 是 2。查询目标计数也得到 1,说明先前的成功写入仍留在诊断索引中。
在 failures[0] 里顺着 id、cause.type 和 cause.caused_by 找原因,再拿文档原值对目标映射。示例的整数映射接受可转换的字符串 "120",却无法解析 "pending"。
GET orders-demo-check/_mapping
GET orders-demo-v1/_doc/2
GET orders-demo-check/_count预建目标索引时应明确映射、分片和副本配置。_reindex 从源文档的 _source 取数据,目标设置、模板结果和映射应独立核验。权限错误则先核对源的读取权限、目标的写入权限,以及建索引所需权限。
本例把 pending 解释为订单金额尚未产生,因此迁移时移除该字段,并使用空的新目标。若原状态仍参与查询,先为它设计独立字段,再取样验证转换后的数据。
PUT orders-demo-v2
{"settings":{"number_of_replicas":0},"mappings":{"properties":{"amount":{"type":"integer"}}}}
POST _reindex?refresh=true
{
"source":{"index":"orders-demo-v1"},
"dest":{"index":"orders-demo-v2","op_type":"create"},
"script":{
"lang":"painless",
"source":"if (params.pending.equals(ctx._source.amount)) { ctx._source.remove('amount'); }",
"params":{"pending":"pending"}
}
}GET orders-demo-v1/_count
GET orders-demo-v2/_count
GET orders-demo-v2/_doc/1
GET orders-demo-v2/_doc/2
GET orders-demo-v2/_search
{
"_source":false,
"fields":["amount"],
"query":{"range":{"amount":{"gte":100}}}
}目标刷新后,源和目标都能数到两条文档。ID 1 保留字符串形式的原值,但搜索返回的 fields.amount 是整数 120。ID 2 缺少金额字段,范围查询只返回 ID 1。

created、updated、retries 和 throttled_millis。进度持续增长时结合限速和集群负载判断,写入重试上涨时查写入拒绝与资源压力。GET _cat/allocation?v 和 GET _cluster/health。若错误指向磁盘,先释放容量或扩容,再确认写入块已解除。op_type=create 遇到已有 ID 会冲突。确认目标中已有文档都应保留时,才考虑用请求体的 conflicts: proceed 跳过并核对冲突数。它只处理版本冲突,映射失败仍要修正。_aliases 请求里移除旧目标并加入新目标。映射失败时先用少量文档验证转换,再迁移到新目标。任务慢时先确认实际进度和集群压力。准备切换时,同时核对失败记录、数据范围和应用查询,并确认切换前的变更已经同步。