千分尺无法将度量保存到Elasticsearch,因为最终映射将具有不止一种类型:[_doc,doc]

时间:2019-11-04 17:57:50

标签: spring-boot elasticsearch micrometer

我正在尝试实施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)?

我在文档中看不到任何有关文档类型或其密钥或与之相关的东西

同样,索引尚未预先创建,我让千分尺创建它们,所以这怎么不起作用。

Elasticsearch 7.4.2

千分尺1.2.1

Spring boot 2.1.2

1 个答案:

答案 0 :(得分:0)

使用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,问题也可能是由于不兼容的依赖版本造成的。