gpt4 book ai didi

ruby-on-rails - 在Elasticsearch中处理大量碎片

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

每个商店都有自己的一组库存,这些库存作为一个索引存储在elasticsearch中。目前,我有11000家商店,这意味着它有11000个分片,这些分片的索引很难在32 GB的ram服务器中获取数据。

有人可以指导如何在Elasticsearch中存储每个商店的库存,因为为每个商店库存创建单独的索引对我没有帮助吗?

以下是索引的映射。 Elasticsearch使用的版本是6.0.1

{
"staging_shop_inventory_558" : {
"mappings" : {
"shop_inventory" : {
"properties" : {
"alternate_name" : {
"type" : "text",
"analyzer" : "standard"
},
"brand" : {
"properties" : {
"created_at" : {
"type" : "date"
},
"id" : {
"type" : "integer"
},
"image" : {
"type" : "text",
"index" : false
},
"is_selected" : {
"type" : "boolean"
},
"name" : {
"type" : "text",
"analyzer" : "standard"
},
"updated_at" : {
"type" : "date"
}
}
},
"brand_autocomplete" : {
"type" : "text",
"analyzer" : "autocomplete",
"search_analyzer" : "autocomplete_search"
},
"brand_suggest" : {
"type" : "text",
"analyzer" : "ngram_analyzer"
},
"category" : {
"properties" : {
"id" : {
"type" : "integer"
},
"image" : {
"type" : "text",
"index" : false
},
"name" : {
"type" : "text",
"analyzer" : "standard"
}
}
},
"created_at" : {
"type" : "date"
},
"deleted_at" : {
"type" : "date"
},
"id" : {
"type" : "integer"
},
"image" : {
"type" : "text",
"index" : false
},
"is_deleted" : {
"type" : "boolean"
},
"name" : {
"type" : "text",
"fields" : {
"raw" : {
"type" : "keyword"
}
},
"analyzer" : "gramAnalyzer",
"search_analyzer" : "whitespace_analyzer"
},
"name_autocomplete" : {
"type" : "text",
"analyzer" : "autocomplete",
"search_analyzer" : "autocomplete_search"
},
"name_suggest" : {
"type" : "text",
"analyzer" : "ngram_analyzer"
},
"product_id" : {
"type" : "integer"
},
"product_sizes" : {
"type" : "nested",
"properties" : {
"deleted_at" : {
"type" : "date"
},
"description" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"ean_code" : {
"type" : "keyword"
},
"id" : {
"type" : "integer"
},
"in_stock" : {
"type" : "boolean"
},
"is_deleted" : {
"type" : "boolean"
},
"price" : {
"type" : "float"
},
"product_id" : {
"type" : "long"
},
"product_update_on" : {
"type" : "date"
},
"product_update_status" : {
"type" : "integer"
},
"uom" : {
"type" : "keyword"
},
"weight" : {
"type" : "float"
}
}
},
"sub_category" : {
"properties" : {
"created_at" : {
"type" : "date"
},
"id" : {
"type" : "integer"
},
"image" : {
"type" : "text",
"index" : false
},
"is_selected" : {
"type" : "boolean"
},
"name" : {
"type" : "text",
"analyzer" : "standard"
},
"updated_at" : {
"type" : "date"
}
}
},
"sub_category_suggest" : {
"type" : "text",
"analyzer" : "gramAnalyzer",
"search_analyzer" : "whitespace_analyzer"
}
}
}
}
}
}

最佳答案

哇,您的节点中只有11 GB碎片(可能更多取决于复制因子),而该碎片只有32 GB RAM(再次注意,这不是分配给Elasticsearch进程的JVM),其性能很大程度上取决于JVM的大小和beyond 32GB deteriorates

Elasticsearch是一个分布式系统,可以轻松扩展到数千个节点,您应该在集群中添加更多节点,并将Elasticsearch索引分发到集群中的所有节点。

另外,请遵循opster's article on shards and replicas,它将提供各种详细信息,例如

  • 分片和副本的内部结构
  • 实现更好性能的重要性
  • 进行配置的提示。
  • 关于ruby-on-rails - 在Elasticsearch中处理大量碎片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62038832/

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