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

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

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

Elasticsearch 7.4.2

千分尺1.2.1

Spring 启动2.1.2

最佳答案

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

09-04 12:58