亲爱的(我希望的)救世主,
我对 elasticsearch 和 mondogdb 数据索引有一个非常烦人的问题。
情况是这样的:我有 2 个 mongodb 集合、记录和pois,我需要使用 River 插件(已弃用,我知道)在 elasticsearch 上建立索引。
(记录有一个对 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"
}
}'
怎么了?
提前致谢