由于产品检查调用不成功,客户端无法验证服务器是否为 Elasticsearch

问题描述 投票:0回答:2

我使用ElasticSearch 8.1.2 和巢 17.7.1

var settings = new ConnectionSettings(new Uri("http://localhost:9200/"))
            .CertificateFingerprint("A5:8B:07:2D:A9:E8:53:CE:GB:C0:15:CE:6E:DF:9C:65:89:A3:AC:D2:94:2C:46:BD:85:23:20:6B:F2:69:B3:88")
            .BasicAuthentication("elastic", "-L-uXRg5=iOXGFgebP68")                  
            .DeadTimeout(TimeSpan.FromSeconds(300))
            .DefaultIndex("people");
var client = new ElasticClient(settings);
var person = new Person
{
    Id = 1,
    FirstName = "Martijn",
    LastName = "Laarman"
};
var asyncIndexResponse = await client.IndexDocumentAsync(person);
return Task.CompletedTask;

但我有错误 enter image description here

错误信息: Message =“由于产品检查调用不成功,客户端无法验证服务器是否为 Elasticsearch。如果服务器运行不受支持的产品,某些功能可能不兼容。调用:状态代码未知,来自:GET /”

asp.net-core elasticsearch nest
2个回答
5
投票

在连接设置中启用兼容性标头:

settings.EnableApiVersioningHeader(); // enable ES 7.x compatibility on ES 8.x servers

在此处启用兼容模式


0
投票

如果你想使用 http 而不是 https 并且 ElasticSearch 默认使用 SSL/TLS,你可以尝试通过 .yaml 文件禁用它:

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elasticsearch
spec:
  version: 7.6.0
  nodeSets:
  - name: default
    count: 1
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
      xpack.security.authc:
          anonymous:
            username: anonymous
            roles: superuser
            authz_exception: false
  http:
    tls:
      selfSignedCertificate:
        disabled: true

这是一个示例文件,但请考虑“http”部分:这允许您禁用 https 并在 http 中公开您的 elasticSearch。

© www.soinside.com 2019 - 2024. All rights reserved.