Home Articles

使用MongoDB的ElasticSearch不会为大对象编制索引

Asked
Viewed 1914 times
3

我用下面的信息创建了ES(带有MongoDB河流插件)索引:

{
    "type": "mongodb",
    "mongodb": {
        "db": "mydatabase",
        "collection": "Users"
    },
    "index": {
        "name": "users",
        "type": "user"
    }
}

当我插入简单的对象时:

{
   "name": "Joe",
   "surname": "Black"
}

一切都没有问题(我可以使用ES Head web界面查看数据) . 但是当我插入更大的对象时,它不会将其编入索引:

{
    "object": {
        "text": "Let's do it again!",
        "boolTest": false
    },
    "type": "coolType",
    "tags": [
            ""
    ],
    "subObject1": {
        "count": 0,
        "last3": [],
        "array": []
    },
    "subObject2": {
        "count": 0,
        "last3": [],
        "array": []
    },
    "subObject3": {
        "count": 0,
        "last3": [],
        "array": []
    },
    "usrID": "5141a5a4d8f3a79c09000001",
    "created": Date(1363527664000),
    "lastUpdate": Date(1363527664000)
}

请问哪里有问题?

谢谢您的帮助!

编辑:这是ES控制台的错误:

org.elasticsearch.index.mapper.MapperParsingException:[stream]的对象映射尝试解析为对象,但得到了EOF,是否已经提供了具体的值? org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:457)位于org.elasticsearch.index.mapper.DocumentMapper的org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:486)位于org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:157)的org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:318)的.parse(DocumentMapper.java:430) org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction $ AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:533)at java.util上的org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction $ AsyncShardOperationAction $ 1.run(TransportShardReplicationOperationAction.java:431) .concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)位于java.lang.Thre的java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615) ad.run(Thread.java:722)[2013-03-20 10:35:05,697] [WARN] [org.elasticsearch.river.mongodb.MongoDBRiver $ Indexer]无法在批量执行中执行失败:[0]:index [stream],输入[stream],id [514982c9b7b3bfbdb488ca81],消息[MapperParsingException [对象映射为[stream]试图解析为对象,但得到了EOF,是否已经提供了具体的值?]] [2013-03- 20 10:35:05,698] [INFO] [org.elasticsearch.river.mongodb.MongoDBRiver $ Indexer]索引1个文档,1个插入0,更新,0个删除,每秒0个文档

1 Answer

  • 1

    您使用的是哪个版本的MongoDB河?请看问题#26 [1] . 它包含有关索引大型json文档的示例,没有任何问题 .

    如果您仍然可以重现该问题,请提供更多详细信息:河流设置,mongodb(版本,特定设置),elasticsearch(版本,特定设置) .

Related