mongo-connector --unique-key=id --auto-commit-interval=0 -m localhost:27017 -t http://localhost:8983/solr -d /Library/Python/2.7/site-packages/mongo_connector/doc_managers/solr_doc_manager.py --admin-username admin --password bypass
我正在使用以下内容连接MongoDB和Apache Solr,但最后我收到以下错误:
2014-05-17 12:38:20,607 - INFO - Beginning Mongo Connector
2014-05-17 12:38:22,200 - INFO - Starting new HTTP connection (1): localhost
2014-05-17 12:38:22,439 - INFO - Finished 'http://localhost:8983/solr/admin/luke?show=schema&wt=json' (get) with body '' in 0.404 seconds.
2014-05-17 12:38:22,527 - INFO - OplogThread: Initializing oplog thread
2014-05-17 12:38:22,580 - INFO - MongoConnector: Starting connection thread MongoClient('localhost', 27017)
Exception in thread Thread-2:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/Library/Python/2.7/site-packages/mongo_connector/oplog_manager.py", line 181, in run
dm.remove(entry)
File "/Library/Python/2.7/site-packages/mongo_connector/doc_managers/solr_doc_manager.py", line 192, in remove
self.solr.delete(id=str(doc[self.unique_key]),
KeyError: 'id'
请帮帮我。
答案 0 :(得分:0)
您是否明确创建了一个名为" id"的唯一字段?这不是MongoDB添加的默认字段,默认的唯一字段是" _id"。