0

我正在 ASP.net 中开发,目前正在使用 NEST 插件。我有一个实体框架数据库模型和弹性搜索似乎无法建立连接:

Uri uri = new Uri("http://localhost:52009");
ConnectionSettings elasticSettings = new ConnectionSettings(uri);
ElasticClient client = new ElasticClient(elasticSettings);
ConnectionStatus connectionStatus;
Debug.WriteLine(client.TryConnect(out connectionStatus)); // prints FALSE
    elasticSettings.SetDefaultIndex("name");

我相信这是由于连接设置错误,因为这会在我的调试器中打印出来:

System.dll 中出现“System.Net.WebException”类型的第一次机会异常 Newtonsoft.Json.dll 中出现“Newtonsoft.Json.JsonReaderException”类型的第一次机会异常

但除此之外,我没有得到任何更多的错误详细信息。

4

1 回答 1

0

Have you verified that ElasticSearch is working correctly?

I know all the examples use port 9200 and you are using port 52009.

If you browse to

http://localhost:52009/

to you see the following json:

{
  "ok" : true,
  "status" : 200,
  "name" : "Whiplash",
  "version" : {
    "number" : "0.90.2",
    "snapshot_build" : false,
    "lucene_version" : "4.3.1"
  },
  "tagline" : "You Know, for Search"
}
于 2013-07-20T00:31:13.303 回答