我们有多个组织在数据库中具有相同的记录结构。我们为每个组织使用具有别名索引和路由功能的 ES。现在,当我们清除 ES 索引并从干净状态开始时,搜索记录将正确地来自 ES。但是当我们添加多个组织时,ES 的行为很奇怪。有时它正在发送另一个组织的数据,有时它只是抑制数据。更令人震惊的是,有时它正在发送甚至没有搜索到的记录数据!“john”正在重新调整“Ringo”,通过“Mick”搜索返回“John”。
进一步调查:
- 仅索引一个组织。该组织的数据即将到来。
- 索引另一个组织。该组织的数据也即将到来。
- 索引第三个组织。第一个组织的数据丢失了!
图片 :
- 清洁状态: https ://imageshack.com/i/idNW3QVCp
- 与一个组织。被索引:
- 与另一个组织。被索引:
- 与第三个组织。被索引:
- 来自 Sf2 的日志:
ES服务器状态:
{
"_shards" : {
"total" : 10,
"successful" : 5,
"failed" : 0
},
"indices" : {
"organizations" : {
"index" : {
"primary_size_in_bytes" : 54928,
"size_in_bytes" : 54928
},
"translog" : {
"operations" : 106
},
"docs" : {
"num_docs" : 50,
"max_doc" : 73,
"deleted_docs" : 23
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 125,
"total_time_in_millis" : 204
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
},
"shards" : {
"0" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "ficq9zDSRM2HJTGLk2BZ7g",
"relocating_node" : null,
"shard" : 0,
"index" : "organizations"
},
"state" : "STARTED",
"index" : {
"size_in_bytes" : 15923
},
"translog" : {
"id" : 1432033150513,
"operations" : 42
},
"docs" : {
"num_docs" : 21,
"max_doc" : 21,
"deleted_docs" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 25,
"total_time_in_millis" : 114
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
}
} ],
"1" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "ficq9zDSRM2HJTGLk2BZ7g",
"relocating_node" : null,
"shard" : 1,
"index" : "organizations"
},
"state" : "STARTED",
"index" : {
"size_in_bytes" : 123
},
"translog" : {
"id" : 1432033150524,
"operations" : 0
},
"docs" : {
"num_docs" : 0,
"max_doc" : 0,
"deleted_docs" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 25,
"total_time_in_millis" : 1
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
}
} ],
"2" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "ficq9zDSRM2HJTGLk2BZ7g",
"relocating_node" : null,
"shard" : 2,
"index" : "organizations"
},
"state" : "STARTED",
"index" : {
"size_in_bytes" : 4782
},
"translog" : {
"id" : 1432033150529,
"operations" : 8
},
"docs" : {
"num_docs" : 8,
"max_doc" : 8,
"deleted_docs" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 25,
"total_time_in_millis" : 11
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
}
} ],
"3" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "ficq9zDSRM2HJTGLk2BZ7g",
"relocating_node" : null,
"shard" : 3,
"index" : "organizations"
},
"state" : "STARTED",
"index" : {
"size_in_bytes" : 123
},
"translog" : {
"id" : 1432033150518,
"operations" : 0
},
"docs" : {
"num_docs" : 0,
"max_doc" : 0,
"deleted_docs" : 0
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 25,
"total_time_in_millis" : 0
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
}
} ],
"4" : [ {
"routing" : {
"state" : "STARTED",
"primary" : true,
"node" : "ficq9zDSRM2HJTGLk2BZ7g",
"relocating_node" : null,
"shard" : 4,
"index" : "organizations"
},
"state" : "STARTED",
"index" : {
"size_in_bytes" : 33977
},
"translog" : {
"id" : 1432033150546,
"operations" : 56
},
"docs" : {
"num_docs" : 21,
"max_doc" : 44,
"deleted_docs" : 23
},
"merges" : {
"current" : 0,
"current_docs" : 0,
"current_size_in_bytes" : 0,
"total" : 0,
"total_time_in_millis" : 0,
"total_docs" : 0,
"total_size_in_bytes" : 0
},
"refresh" : {
"total" : 25,
"total_time_in_millis" : 78
},
"flush" : {
"total" : 0,
"total_time_in_millis" : 0
}
} ]
}
}
}
}
当另一个组织时,似乎 ES 正在覆盖现有别名的数据。正在被索引。但这是交易破坏者。请指教。