Elasticsearch OutOfMemoryError Java heap space while indexing a document

Elasticsearch OutOfMemoryError Java heap space while indexing a document

我正在尝试将 3 个文档编入索引。我已经能够成功地索引前两个,但是在索引第三个时,我在终端中收到与堆 space 相关的错误。 我尝试将 jvm.options 文件中的堆大小增加到 3g,因为我只有 4GB 的 RAM,但它仍然没有帮助。这是我的文档的样子,以前索引的文档与它相似仅坐标值发生变化:

curl -XPUT 'localhost:9200/test/test1/2?pretty&pretty' -H 'Content-Type: application/json' -d'

  {
    "createdAt": "2017-03-30T12:36:28.061Z",
    "updatedAt": "2017-03-30T12:36:28.061Z",
    "id": "g5G4c",
    "user": "0000-0002-1194-2058",
    "metadata": {
        "raw": {
            "author": [
                {
                    "affiliation": [],
                    "name": "Markus Konkol",
                    "orcid": "0000-0002-4898-0314"
                }
            ],
            "community": "o2r",
            "date": "30 November 2016",
            "depends": [
                {
                    "category": "CRAN Top100",
                    "identifier": "shiny",
                    "packageSystem": "https://cloud.r-project.org/",
                    "version": null
                },
                {
                    "category": "none",
                    "identifier": "likert",
                    "packageSystem": "https://cloud.r-project.org/",
                    "version": null
                }
            ],
            "description": null,
            "ercIdentifier": "g5G4c",
            "file": {
                "filename": "main.Rmd",
                "filepath": "g5G4c/data/main.Rmd",
                "mimetype": "text/markdown"
            },
            "generatedBy": "o2r-meta metaextract.py",
            "inputfiles": [
                "/tmp/o2r/compendium/g5G4c/data/quest.csv"
            ],
            "interaction": {
                "interactive": true
            },
            "keywords": [],
            "license": null,
            "output": {
                "html_document": {
                    "number_sections": true
                }
            },
            "paperLanguage": [
                "en"
            ],
            "paperSource": "main.Rmd",
            "publicationDate": null,
            "r_comment": [
                {
                    "feature": "comment",
                    "line": 29,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 32,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 37,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 81,
                    "text": "Participants"
                },
                {
                    "feature": "comment",
                    "line": 84,
                    "text": "What are you doing in the context of scientific publications"
                },
                {
                    "feature": "comment",
                    "line": 86,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 89,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 92,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 118,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 119,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 120,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 123,
                    "text": "What are your research fields"
                },
                {
                    "feature": "comment",
                    "line": 192,
                    "text": "Please tell us your age"
                },
                {
                    "feature": "comment",
                    "line": 198,
                    "text": "Please tell us your gender"
                },
                {
                    "feature": "comment",
                    "line": 203,
                    "text": "Reproducible research"
                },
                {
                    "feature": "comment",
                    "line": 237,
                    "text": "Interaction"
                },
                {
                    "feature": "comment",
                    "line": 239,
                    "text": "Relating to your last five publications"
                },
                {
                    "feature": "comment",
                    "line": 262,
                    "text": "While reading a scientific publication that is related to my own research work"
                },
                {
                    "feature": "comment",
                    "line": 273,
                    "text": "It would be useful for my research work"
                },
                {
                    "feature": "comment",
                    "line": 283,
                    "text": "For my research work I would like to search for other scientific publications on the web by using"
                }
            ],
            "r_input": [
                {
                    "feature": "data input",
                    "line": 8,
                    "text": "quest.csv"
                }
            ],
            "r_output": [
                {
                    "feature": "result",
                    "line": 67,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 69,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 76,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 77,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 112,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 118,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 119,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 120,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 179,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 182,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 183,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 184,
                    "text": "print"
                }
            ],
            "recordDateCreated": "2017-03-30",
            "runtime": "shiny",
            "softwarePaperCitation": null,
            "spatial": {
                "files": [],
                "union": []
            },
            "temporal": {
                "begin": "2016-11-30T00:00:00",
                "end": "2016-12-08T13:55:02"
            },
            "title": "Reproducible research in Geosciences",
            "version": null
        },
        "o2r": {
            "author": [
                {
                    "affiliation": [],
                    "name": "Markus Konkol",
                    "orcid": "0000-0002-4898-0314"
                }
            ],
            "community": "o2r",
            "date": "30 November 2016",
            "depends": [
                {
                    "category": "CRAN Top100",
                    "identifier": "shiny",
                    "packageSystem": "https://cloud.r-project.org/",
                    "version": null
                },
                {
                    "category": "none",
                    "identifier": "likert",
                    "packageSystem": "https://cloud.r-project.org/",
                    "version": null
                }
            ],
            "description": null,
            "ercIdentifier": "g5G4c",
            "file": {
                "filename": "main.Rmd",
                "filepath": "g5G4c/data/main.Rmd",
                "mimetype": "text/markdown"
            },
            "generatedBy": "o2r-meta metaextract.py",
            "inputfiles": [
                "/tmp/o2r/compendium/g5G4c/data/quest.csv"
            ],
            "interaction": {
                "interactive": true
            },
            "keywords": [],
            "license": null,
            "output": {
                "html_document": {
                    "number_sections": true
                }
            },
            "paperLanguage": [
                "en"
            ],
            "paperSource": "main.Rmd",
            "publicationDate": null,
            "r_comment": [
                {
                    "feature": "comment",
                    "line": 29,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 32,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 37,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 81,
                    "text": "Participants"
                },
                {
                    "feature": "comment",
                    "line": 84,
                    "text": "What are you doing in the context of scientific publications"
                },
                {
                    "feature": "comment",
                    "line": 86,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 89,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 92,
                    "text": "sum of "
                },
                {
                    "feature": "comment",
                    "line": 118,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 119,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 120,
                    "text": "print"
                },
                {
                    "feature": "comment",
                    "line": 123,
                    "text": "What are your research fields"
                },
                {
                    "feature": "comment",
                    "line": 192,
                    "text": "Please tell us your age"
                },
                {
                    "feature": "comment",
                    "line": 198,
                    "text": "Please tell us your gender"
                },
                {
                    "feature": "comment",
                    "line": 203,
                    "text": "Reproducible research"
                },
                {
                    "feature": "comment",
                    "line": 237,
                    "text": "Interaction"
                },
                {
                    "feature": "comment",
                    "line": 239,
                    "text": "Relating to your last five publications"
                },
                {
                    "feature": "comment",
                    "line": 262,
                    "text": "While reading a scientific publication that is related to my own research work"
                },
                {
                    "feature": "comment",
                    "line": 273,
                    "text": "It would be useful for my research work"
                },
                {
                    "feature": "comment",
                    "line": 283,
                    "text": "For my research work I would like to search for other scientific publications on the web by using"
                }
            ],
            "r_input": [
                {
                    "feature": "data input",
                    "line": 8,
                    "text": "quest.csv"
                }
            ],
            "r_output": [
                {
                    "feature": "result",
                    "line": 67,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 69,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 76,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 77,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 112,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 118,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 119,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 120,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 179,
                    "text": "plot"
                },
                {
                    "feature": "result",
                    "line": 182,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 183,
                    "text": "print"
                },
                {
                    "feature": "result",
                    "line": 184,
                    "text": "print"
                }
            ],
            "recordDateCreated": "2017-03-30",
            "runtime": "shiny",
            "softwarePaperCitation": null,
            "spatial": {
                  "geometry": {
                    "type": "polygon",
                            "coordinates": [
            [ [-93.0, 66.0], [-96.0, 50.0], [-129.0, 50.0], [-131.0, 66.0], [-93.0, 66.0] ]
                                  ]
                            }
                        },                                   
            "temporal": {
                "begin": "2017-08-01T22:00:00.000Z",
                "end": "2017-03-30T12:35:41.142Z"
            },
            "title": "Reproducible research in Geosciences",
            "version": null
        },
        "zenodo": {
            "title": "Reproducible research in Geosciences"
        },
        "cris": {
            "title": "Reproducible research in Geosciences"
        },
        "orcid": {
            "title": "Reproducible research in Geosciences"
        },
        "datacite": {
            "title": "Reproducible research in Geosciences"
        }
    },
    "jobs": [],
    "created": "2017-03-30T12:35:35.774Z",
    "__v": 0

}'

索引映射

curl -XPUT 'localhost:9200/test/?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"test1":{
"properties":{
"metadata":{
"properties":{
"o2r":{
"properties":{
"spatial": {
"properties": {
"geometry": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1m"
}
}
}
}
}
}}}}}}'

我能够通过将索引映射的精度从 1m 更改为 2m 来解决它。由于我的 RAM 位于较低的一侧,因此它对空间索引的精度要求较低。