我的机器上运行了两个 elasticsearch 版本,一个是 1.7 另一个是 2.3
我能够在 1.7 版本中索引文档,但相同的索引语句抛出 u'caused_by': {u'reason': u'Java heap space', u'type': u 2.3 中的“out_of_memory_error”
。
Elasticsearch 2.3 的映射
{
"id": {
"type": "integer",
"store": "yes",
"index": "analyzed"
},
"field1": {
"type": "integer",
"store": "yes",
"index": "no"
},
"field2": {
"type": "integer",
"store": "yes",
"index": "no"
},
"field3": {
"type": "string",
"store": "yes",
"index": "no"
},
"field4": {
"type": "geo_shape",
"tree": "legacyquadtree",
"precision": "1mm"
}
}
Elasticsearch 1.7 的映射
{
"id": {
"type": "integer",
"store": "yes",
"index": "analyzed"
},
"field1": {
"type": "integer",
"store": "yes",
"index": "no"
},
"field2": {
"type": "integer",
"store": "yes",
"index": "no"
},
"field3": {
"type": "string",
"store": "yes",
"index": "no"
},
"field4": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1mm"
}
}
用于索引的文档结构是(2.3 和 1.7 相同)
{
"field4":
{"type": "envelope", "coordinates":
data},
"id": id,
"field1": val1,
"field2": val2,
"field3": val3
}
指定的 JAVA_HEAP_SIZE
是两个版本的默认值。
最佳答案
尝试增加 JAVA_HEAP_SPACE。它对我有用
- 从“/etc/sysconfig”打开 Elasticsearch 文件
sudo vi/etc/sysconfig/elasticsearch
2.你可以在这里改变堆大小
ES_HEAP_SIZE=2g
(默认大小为 2gb。您可以将其增加到可用 ram 的 50%)
关于Elasticsearch 2.3 与 elasticsearch 1.7 Java 堆空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40378155/