.Net使用Elastic.Clients.Elasticsearch连接Elasticsearch8

文章目录


1、elasticsearch.yml配置

单一节点配置

yaml 复制代码
node.name: node-1

path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch

network.host: localhost
http.port: 9200

xpack.security.enabled: true
xpack.security.enrollment.enabled: true

xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12

http.host: 0.0.0.0

2、生成证书指纹

bash 复制代码
cd /etc/elasticsearch/certs
openssl x509 -in http_ca.crt -sha256 -fingerprint | grep SHA256 | sed 's/://g'
复制代码
SHA256 Fingerprint=ABE1B0CEBA7D45461430B48A7804DFDC6ECB136CDF4523F01106D863F4826BD1

3、使用Elastic.Clients.Elasticsearch连接

csharp 复制代码
var settings1 = new ElasticsearchClientSettings(new Uri($"https://{_elasticModel.IP}:{_elasticModel.Port}"))
	.CertificateFingerprint("ABE1B0CEBA7D45461430B48A7804DFDC6ECB136CDF4523F01106D863F4826BD1")
	.Authentication(new BasicAuthentication(_elasticModel.UserName, _elasticModel.Password));

4、参考

https://www.elastic.co/guide/en/elasticsearch/client/net-api/8.13/connecting.html


相关推荐
Dragon~Snow13 小时前
Linux Centos9 安装 Elasticsearch
linux·elasticsearch·jenkins
熊延13 小时前
麒麟V10系统安装部署elasticsearch
linux·运维·服务器·elasticsearch·搜索引擎·全文检索
weisian15113 小时前
Elasticsearch-1--什么是ES?
大数据·elasticsearch·搜索引擎
玄同76514 小时前
Git常用命令指南
大数据·git·elasticsearch·gitee·github·团队开发·远程工作
Elasticsearch15 小时前
弥合差距:从云原生到大型机的端到端可观测性
elasticsearch
java-yi18 小时前
Elasticsearch(ES)核心用法与实战技巧分享
大数据·elasticsearch·搜索引擎
星辰_mya19 小时前
Es之脑裂
大数据·elasticsearch·搜索引擎
历程里程碑1 天前
普通数组-----除了自身以外数组的乘积
大数据·javascript·python·算法·elasticsearch·搜索引擎·flask
闲人编程2 天前
Elasticsearch搜索引擎集成指南
python·elasticsearch·搜索引擎·jenkins·索引·副本·分片
先跑起来再说2 天前
Git 入门到实战:一篇搞懂安装、命令、远程仓库与 IDEA 集成
ide·git·后端·elasticsearch·golang·intellij-idea