.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


相关推荐
Elasticsearch2 小时前
Kibana:使用 ES|QL 构建地图,对国家或地区的指标进行对比
elasticsearch
Dxy12393102164 小时前
Elasticsearch如何做向量搜索
大数据·elasticsearch
cui_win4 小时前
Elasticsearch 分片满了?「cluster.max_shards_per_node」报错
大数据·elasticsearch·搜索引擎
Elasticsearch5 小时前
使用 Node.js Elasticsearch 客户端索引大型 CSV 文件
elasticsearch
Elastic 中国社区官方博客6 小时前
Elasticsearch:构建一个 AI 驱动的电子邮件钓鱼检测
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
Elastic 中国社区官方博客7 小时前
Kibana 数据可视化的新配色方案 —— 我们如何以及为什么创建它
大数据·elasticsearch·搜索引擎·信息可视化·全文检索·kibana
Elastic 中国社区官方博客9 小时前
Elastic 在 AWS re:Invent:总结一年在 agentic AI 创新中的合作
大数据·人工智能·elasticsearch·搜索引擎·云计算·全文检索·aws
叮咚侠9 小时前
将已创建的Elasticsearch 8.12.0的docker容器中的数据挂载到宿主机操作步骤
运维·elasticsearch·docker·容器·kibana
liliangcsdn9 小时前
elasticsearch多字段组合查询示例
大数据·elasticsearch·搜索引擎
野生技术架构师9 小时前
SpringBoot+Elasticsearch实现高效全文搜索
spring boot·elasticsearch·jenkins