elasticsearch - 为什么有时 Elasticsearch 滚动或搜索会返回一组无法单独检索的文档 ID?
问题描述
我看到一个奇怪的问题,即 Elasticsearch 滚动或搜索 API 返回一组我无法再通过 id 获取的文档。我正在使用使用 Elasticsearch 作为二级索引存储的 Elassandra (Cassandra + ES)。Cassandra 记录上有 TTL,但由于 TTL 而被丢弃,但 Elasticsearch 中的 id 仍然存在。为什么会出现这种奇怪的行为?我确实刷新并强制合并了 Elasticsearch 上的相应索引,但没有帮助。
解决方案
好的。我发现了问题。Cassandra 上的 TTL 字段会删除 Cassandra 上的记录,但基于 Elasticsearch 构建的自定义二级索引 Elassandra 不会被该机制删除。事实上,更高版本的 ES 上不再存在 TTL。文档需要从 ES 中显式删除,或者我们需要在 ES 上进行时间分区索引,以便可以删除旧索引。
推荐阅读
- mysql - SQL查询总和,乘以并组合5个表然后分组
- flask - 连接到 localhost:6379 时出现错误 99。无法分配请求的地址
- c - C中的多个1对1管道
- python - 如果数据是通过将一个 Raspberry Pi 连接到另一个 Raspberry Pi 的 XBees 发送的,则查找 RSSI 值
- python - 仅在集合中查找超弦
- clojure - 如何在 Clojure 中实现 TemporalAdjuster
- maven - 调用编译生命周期阶段来测试我的源生成 maven 插件
- python - 为什么调用 main() 会显示 NameError?
- python-3.x - 如何在特定列中获取列表的并集
- vb.net - 在 VB.net 中使用 Microsoft Graph 连接到 OneDrive