这是错误
{ Error: [mapper_parsing_exception] No handler for type [string] declared on field [type]
at respond (/home/jilu/Documents/project/backup/assignment_ok/node_modules/elasticsearch/src/lib/transport.js:289:15)
at checkRespForFailure (/home/jilu/Documents/project/backup/assignment_ok/node_modules/elasticsearch/src/lib/transport.js:248:7)
at HttpConnector.<anonymous> (/home/jilu/Documents/project/backup/assignment_ok/node_modules/elasticsearch/src/lib/connectors/http.js:164:7)
at IncomingMessage.wrapper (/home/jilu/Documents/project/backup/assignment_ok/node_modules/elasticsearch/node_modules/lodash/lodash.js:4968:19)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
status: 400,
displayName: 'BadRequest',
message: '[mapper_parsing_exception] No handler for type [string] declared on field [type]',
并且映射没有创建
请说明单石怪的配置。
我正在使用Express JS和MongoDb作为后端。
在if call search Api之后,我得到了:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
Hits数组为null,total为零,映射也显示为空。
最佳答案
设置Mongoosastic 4.3 + Elasticsearch 6.2后,我遇到了相同的问题,原因是Mongoosastic与Elasticsearch 6.x不兼容!
如果您使用google,则会发现Elasticsearch将默认类型从'string'更改为'text'及其记录的here。在帖子末尾,他们说了以下几点:
我发现Mongoosastic与最新的Elasticsearch 6.2还有更多不兼容之处。我已提交pull request进行这些更改,但不确定何时/是否将被接受。在他们修复正式版本之前,我将Mongoosastic的克隆与修复一起使用,直到他们对正式回购进行补丁。
关于mongodb - mongoosastic [mapper_parsing_exception]没有在字段[type]上声明类型[string]的处理程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48126274/