1

如果我不设置大小,我可以获得 10 次点击:

SearchResponse sr = client.prepareSearch("xxx").setTypes("xxx")
                .setQuery(rangeQueryBuilder)
                .setQuery(queryBuilder)

但是当我设置大小超过 12 时:

SearchResponse sr = client.prepareSearch("xxx").setTypes("xxx")
                .setSize(13)
                .setQuery(rangeQueryBuilder)
                .setQuery(queryBuilder)

我遇到了这个问题:NoNodeAvailableException[没有配置的节点可用:[{gw_172.28.236.85:40001}{oHcfPhqFQDSW4opwUuzCpA}{P1GbtDqrRda4nlbRRBmW1Q}{172.28.236.85}{172.28.236.85:40101}{xpack.installed=true} ,我的java连接代码:

    public static TransportClient client() throws UnknownHostException {
    if (client != null) {
        return client;
    }
    synchronized (esConnection_old.class) {
        if (client == null) {
            Settings settings = Settings.builder().put("cluster.name", ClusterName)
                    .put("client.transport.sniff", false)
                    .put(SecurityKey, basicAuthHeaderValue(SecurityUser, SecurityPassword))
                    .build();

            client = new PreBuiltTransportClient(settings);


            String[] oneInstance = GatewayIpPorts.split(",");
            for (String item : oneInstance) {
                String[] ipPort = item.split(":");
                client.addTransportAddresses(new TransportAddress(InetAddress.getByName(ipPort[0]), Integer.parseInt(ipPort[1])));
            }
            return client;
        }
        return client;
    }
}
4

1 回答 1

0

通常,当 Elasticsearch 需要在节点上执行特定操作(分片分配、索引和搜索数据)并且找不到可以服务这些请求的节点时,就会出现此异常。

您可以查看NoNodeAvailableException代码并追溯它,我查看了这是最新的代码,但找不到None of the configured nodes were available:您尝试执行的搜索操作。

请提供您的 elasticsearch 版本,并确认此异常只是因为 size 参数值超过 10?

于 2020-07-02T03:29:35.633 回答