gpt4 book ai didi

elasticsearch - Elasticsearch和快速变化的数据

转载 作者:行者123 更新时间:2023-12-03 02:07:04 25 4
gpt4 key购买 nike

我有一个包含100万个文档的索引。

"mappings" : {
"direct" : {
"_source" : { "enabled" : true },
"properties" : {
"post" : { "type" : "integer", "index" : "analyzed", "store" : false},
"author" : { "type" : "integer", "index" : "analyzed", "store" : false},
"views_number" : { "type" : "integer", "index" : "not_analyzed" , "store" : false}
}
}
}

我想每次有人使用 views_number访问页面时更改 post。我建议这种映射不好,因为我们每次都需要重新索引整个文档。而且非常慢。对于这种情况有更好的解决方案吗?

最佳答案

您可以在Elasticsearch中使用父/子功能,并将post设为direct的子代。这将使更新post对象的速度更快,因为您只需要更新各个“post”文档。看一下这篇博客文章:

http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/

关于elasticsearch - Elasticsearch和快速变化的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24841244/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com