【问题标题】:mongoosastic [mapper_parsing_exception] No handler for type [string] declared on field [type]mongoosastic [mapper_parsing_exception] 没有在字段 [type] 上声明的类型 [string] 的处理程序
【发布时间】:2018-06-16 00:20:05
【问题描述】:

这是错误

{ 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]',

并且映射没有创建

请解释一下mongoosastic的配置。

我使用 express JS 和 MongoDb 作为后端。

如果调用搜索 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 为零,映射也显示为空。

【问题讨论】:

    标签: mongodb elasticsearch mongoosastic


    【解决方案1】:

    我在设置 Mongoosastic 4.3 + Elasticsearch 6.2 后遇到了同样的问题,问题是由于 Mongoosastic 与 Elasticsearch 6.x 不兼容!!

    如果你用谷歌搜索,你会发现 Elasticsearch 将默认类型从“字符串”更改为“文本”,并记录了 here。在帖子的最后,他们说:

    也就是说,您仍然应该考虑升级它们,因为我们计划在发布 Elasticsearch 6.0 时移除这个向后兼容层。

    我在 Mongoosastic 上发现了更多与最新的 Elasticsearch 6.2 不兼容的地方。我已经提交了pull request 来进行这些更改,但不确定何时/是否会被接受。在他们修复正式版本之前,我将使用我的 Mongoosastic 克隆进行修复,直到他们修补官方 repo。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-02
      • 1970-01-01
      • 1970-01-01
      • 2017-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多