亲爱的(我希望)救世主,
我对elasticsearch和mondogdb数据索引有一个非常烦人的问题。
情况如下: 我有2个mongodb集合,记录和 pois ,我需要使用河流插件对elasticsearch进行索引(不推荐使用,我知道)。
(Record对poi和其他集合有一个引用(DBRef),在这里称为otherref#。)
现在,当我执行curl调用时,它会发生....有时所有记录文档都被编入索引,有时只是 200 (140k)。有时 900 pois文档被编入索引,有时只是 200 (永远不会全部,大约70k)。
因此,脚本似乎无法正常工作。
我已经监控了/ var / log / elasticsearch日志,但没有记录任何错误。
这里是索引脚本:
curl -XPUT "localhost:9200/lw_index_poi" -d '
{
"mappings": {
"lw_mapping_poi" : {
"properties" : {
"position" : {
"type" : "geo_shape"
},
"poi_id" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}'
curl -XPUT "localhost:9200/lw_index_record" -d '
{
"mappings": {
"lw_mapping_record" : {
"date_detection": false,
"properties" : {
"other_ref1" : {
"type" : "string",
"index" : "not_analyzed"
},
"other_ref2" : {
"type" : "string",
"index" : "not_analyzed"
},
"poi_ref" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}'
curl -XPUT "localhost:9200/_river/lw_index_poi/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"servers":
[
{ "host": "mongodb", "port": 27017 }
],
"options": {
"secondary_read_preference" : false
},
"db": "lifewatch",
"collection": "poi",
"script": "if (ctx.document.decimalLatitude && ctx.document.decimalLongitude) { ctx.document.position = {}; ctx.document.position.type=\"Point\"; ctx.document.position.coordinates = [ctx.document.decimalLongitude, ctx.document.decimalLatitude]; } ctx.document.poi_id = ctx.document._id; delete ctx.document.decimalLatitude; delete ctx.document.decimalLongitude;"
},
"index": {
"name": "lw_index_poi",
"type": "lw_mapping_poi"
}
}'
curl -XPUT "localhost:9200/_river/lw_index_record/_meta" -d '
{
"type": "mongodb",
"mongodb": {
"servers":
[
{ "host": "mongodb", "port": 27017 }
],
"options": {
"secondary_read_preference" : false
},
"db": "lifewatch",
"collection": "record",
"script": "if (ctx.document.ref1) { ctx.document.ref1 = ctx.document.ref1.id; delete ctx.document.ref1;};if (ctx.document.poi) { ctx.document.poi_ref = ctx.document.poi.id; delete ctx.document.poi;};if (ctx.document.ref2) { ctx.document.ref2 = ctx.document.ref2.id; delete ctx.document.ref2;};"
},
"index": {
"name": "lw_index_record",
"type": "lw_mapping_record"
}
}'
出了什么问题?
提前致谢