我是elasticsearch和couchbase的新手。我在我的项目中使用了两者。我的要求是使用couchbase XDCR将couchbase存储桶与elasticsearch索引同步。
在couchbase,Bucket name" Employee"和本文件的结构是
{
"empName":"Stev Jobs",
"dept":"IT",
"company":"xxxx",
"salary":"30000",
"country":"USA"
}
我在elasticsearch中创建了员工的索引,并在带有elasticsearch集群的couchbase中创建了集群引用。 设置完所有这些后,我开始在couchbase的员工桶和elasticsearch的员工索引之间进行复制。它在elasticsearch中创建了索引,但是这个索引包含的不仅仅是couchbase bucket文档。 我的couchbase bucket员工有182条记录,但在elasticsearch员工索引中显示文档1025。 并且在couchbase中同步时显示一些错误s。这个错误如下所示
2015-05-22 09:07:44 [Vb Rep] Error replicating vbucket 98. Please see logs for details.
2015-05-22 09:07:44 [Vb Rep] Error replicating vbucket 697. Please see logs for details.
在elasticsearch中,我的员工索引文档结构如
{
"_index": "employee",
"_type": "couchbaseCheckpoint",
"_id": "vbucket921UUID",
"_score": 1,
"_source": {
"doc": {
"uuid": "ec88aeb16c00427698f079d8a3fa7097"
}
}
}
我编写搜索查询,例如,我在http://127.0.0.1:9200/_plugin/head/
中运行此查询http://127.0.0.1:9200/employee/_search/
{
"query": {
"match":{
"query":"ec88aeb16c00427698f079d8a3fa7097",
"fields":["uuid"]
}
}
}
给出错误
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[J2CjiG2vQqqrG2h5jlsudg][couchrecords][0]: SearchParseException[[couchrecords][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match":{"query":"ec88aeb16c00427698f079d8a3fa7097","fields":["uuid"]}}}]]]; nested: QueryParsingException[[couchrecords] [match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?]; }{[J2CjiG2vQqqrG2h5jlsudg][couchrecords][1]: SearchParseException[[couchrecords][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match":{"query":"ec88aeb16c00427698f079d8a3fa7097","fields":["uuid"]}}}]]]; nested: QueryParsingException[[couchrecords] [match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?]; }{[J2CjiG2vQqqrG2h5jlsudg][couchrecords][2]: SearchParseException[[couchrecords][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match":{"query":"ec88aeb16c00427698f079d8a3fa7097","fields":["uuid"]}}}]]]; nested: QueryParsingException[[couchrecords] [match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?]; }{[J2CjiG2vQqqrG2h5jlsudg][couchrecords][3]: SearchParseException[[couchrecords][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match":{"query":"ec88aeb16c00427698f079d8a3fa7097","fields":["uuid"]}}}]]]; nested: QueryParsingException[[couchrecords] [match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?]; }{[J2CjiG2vQqqrG2h5jlsudg][couchrecords][4]: SearchParseException[[couchrecords][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"match":{"query":"ec88aeb16c00427698f079d8a3fa7097","fields":["uuid"]}}}]]]; nested: QueryParsingException[[couchrecords] [match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?]; }]",
"status": 400
}
答案 0 :(得分:2)
插件使用couchbaseCheckpoint文档来保存每个vBucket的状态,以便它可以正确模拟XDCR协议。这就是为什么有1025个 - 1024个vBuckets加上一个全局状态文档。
您在ElasticSearch中拥有1025个文档的事实意味着您只获得了州文档,并且没有任何实际文档被复制。您是否在ElasticSearch中设置了如安装指南中所述的映射?这看起来像索引的问题,因此ElasticSearch日志实际上会有有意义的错误,它会告诉您为什么它不能索引任何文档。 Couchbase日志只告诉您它无法复制某些内容