我的机器上有两个elasticsearch版本,一个是1.7,另一个是2.3我能够在1.7版本中索引文档,但相同的索引语句在2.3中抛出u'caused_by': {u'reason': u'Java heap space', u'type': u'out_of_memory_error'}
。
{
"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 = 2 g
(默认大小为2gb。您可以将其增加到可用内存的50%)