【问题标题】:Micrometers fails to save metrics to elasticsearch as the final mapping would have more than 1 type: [_doc, doc]千分尺无法将指标保存到弹性搜索,因为最终映射将具有超过 1 种类型:[_doc, doc]
【发布时间】:2019-11-04 17:57:50
【问题描述】:

我正在尝试实施 Micrometer Elasticsearch 注册表,但出现以下错误

      {
    "took": 158,
    "errors": true,
    "items": [
      {
        "index": {
          "_index": "metrics-2019-11",
          "_type": "doc",
          "_id": "PDzhNm4BiJBtovrbDFDF",
          "status": 400,
          "error": {
            "type": "illegal_argument_exception",
            "reason": "Rejecting mapping update to [metrics--2019-11] as the final mapping would have more than 1 type: [_doc, doc]"
          }
        }
      },
      {
        "index": {
          "_index": "metrics--2019-11",
          "_type": "doc",
          "_id": "PTzhNm4BiJBtovrbDFDF",
          "status": 400,
          "error": {
            "type": "illegal_argument_exception",
            "reason": "Rejecting mapping update to [metrics--2019-11] as the final mapping would have more than 1 type: [_doc, doc]"
          }
        }
      }
    ]
  }

我不得不说我不太理解错误,千分尺是否试图将同一个文档推送到2个不同的键(doc和_doc)?

我在文档中没有看到任何关于文档类型或其密钥或任何相关内容的信息

同样,索引没有事先创建,我让千分尺创建它们,所以这怎么行不通。

弹性搜索 7.4.2

千分尺 1.2.1

春季启动 2.1.2

【问题讨论】:

  • 这个问题你解决了吗?我有几个 Spring 应用程序向 elasticsearch 发布指标,其中只有一个面临这个问题。
  • 是的,我做到了,但不记得是怎么回事,这是配置中的愚蠢行为。可惜我没有回来更新问题

标签: spring-boot elasticsearch micrometer


【解决方案1】:

我在使用不兼容的spring-boot-gradle-pluginmavenBom 版本时遇到此错误。

例如,我的 build.gradle 文件中有以下内容:

buildscript {
...
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.5.RELEASE"
    }
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Greenwich.SR1"
    }
}

但是2.2.5.RELEASEGreenwich.SR1不在同一个release trains中。将“Bom”版本更改为Hoxton.SR1 解决了这个问题。

即使你没有使用 gradle,问题也可能是因为依赖版本不兼容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-03
    • 2020-12-11
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多