【问题标题】:NEST Elasticsearch error : The underlying connection was closedNEST Elasticsearch 错误:底层连接已关闭
【发布时间】:2016-02-26 13:23:19
【问题描述】:

我在使用 NEST 客户端通过 ElasticSearch 集群连接时遇到问题。

在我的开发机器上,我可以很好地连接和运行对弹性(在我的本地机器上运行)的查询,但在我们的暂存环境中,我收到错误“System.Net.WebException:底层连接已关闭:连接是意外关闭。”。

我们的暂存环境由 4 台运行 Elastic 的 Linux 机器和一台运行我们的客户端软件的 Windows 机器组成。

我已经在 connectionsettings 上设置了 DisableDirectStreaming()。我还尝试在 web.config 中设置 <httpWebRequest useUnsafeHeaderParsing="true" />,但错误仍然存​​在(但现在 ApiCall.OriginalException 为 NULL)。

通过 Kopf 接口发送查询,返回结果,因此集群似乎可以运行。

有人知道这里出了什么问题吗?

更新: 我正在运行的查询是(其中 indexFilter 和 searchFilter 根据用户请求填充): 此查询适用于我的本地 ES(Windows / ES 2.1.1),但不适用于我的生产 ES(Ubuntu / ES 2.1.1)

QueryContainer indexFilter = new QueryContainer();
QueryContainer searchFilter = new QueryContainer();

var result = db.Client.Search<IndexRecord>
(
    search => search
    .Query
    (
        f => f.HasChild<SearchRecord>
        (
            c => c
            .Query
            (
                f2 => searchFilter
            )
        ) & indexFilter
    )
    .Sort
    (
        ss => ss.Ascending(f => f.AccommodationName)
    )
    .Size(10)
);

【问题讨论】:

  • 你运行的是哪个版本的 ES?
  • 你有发生这种请求的例子吗?是间歇性的吗?通常,您不想设置.DisableDirectStreaming(),除非您想出于某种目的缓冲请求/响应字节,例如记录所有请求
  • 我正在运行 ES 2.1.1。在 Ubuntu 15.10 上。设置.DisableDirectStreaming() 是因为建议它可以解决问题。

标签: elasticsearch nest


【解决方案1】:

我解决了这个问题。不知何故,客户端正在与端口 9300 而不是端口 9200 通信。我修复了这个问题,现在从 ES 获取结果。

【讨论】:

    猜你喜欢
    • 2011-04-10
    • 2014-05-31
    • 1970-01-01
    • 1970-01-01
    • 2020-12-30
    • 2013-10-31
    • 2018-01-31
    • 2017-09-21
    • 2017-09-29
    相关资源
    最近更新 更多