.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


相关推荐
TracyCoder12311 小时前
ElasticSearch内存管理与操作系统(一):内存分配底层原理
大数据·elasticsearch·搜索引擎
春日见16 小时前
Autoware使用教程
大数据·人工智能·深度学习·elasticsearch·搜索引擎·docker·容器
会员源码网17 小时前
Elasticsearch从零启动指南:安装、配置、启停与排坑全解析
大数据·elasticsearch·搜索引擎
lcx_defender18 小时前
【Docker】Docker部署运行Elasticsearch
elasticsearch·docker·jenkins
洛阳纸贵1 天前
JAVA高级工程师--Elasticsearch安装以及内置分词器、IK分词器
大数据·elasticsearch·搜索引擎
Howie Zphile1 天前
Git 拉 NocoBase 2.0 beta(next 分支),并“每天自动更新 + 自动编译 + 自动重启”
大数据·git·elasticsearch
历程里程碑1 天前
子串----和为K的子数组
大数据·python·算法·leetcode·elasticsearch·搜索引擎·哈希算法
2401_859049082 天前
lvgl移植到Linux踩坑
linux·运维·arm开发·elasticsearch·嵌入式·ubantu
峥嵘life2 天前
Android EDLA CTS、GTS等各项测试命令汇总
android·学习·elasticsearch
invicinble2 天前
一文了解git
大数据·git·elasticsearch