当前位置: 代码迷 >> 综合 >> java连接elasticsearch报错NoNodeAvailableException[None of the configured nodes are available: [{#transpo
  详细解决方案

java连接elasticsearch报错NoNodeAvailableException[None of the configured nodes are available: [{#transpo

热度:65   发布时间:2023-12-16 01:55:08.0

在java端连接elasticsearch时,可以输出client信息,但是在做聚合查询求最大值时会报如下异常:

Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{aKmx1XNXTtqhLPNtDvhQVA}{192.168.184.128}{192.168.184.128:9300}]]

看了网上的一些说法,有的是说ip和端口号写的有问题,我检查了一下是对的,还有说是cluster.name有问题,我才明白这里面的cluster.name是要和elasticsearch.yml里面配置的要一样。之前以为这个名字就像kafka里面的group.name一样可以自定义。把cluster.name改为elasticsearch.yml里面一样的cluster.name就可以了。