我正在用ASP.net进行开发,目前使用的是NEST插件。我有一个实体框架数据库模型,而elastic search似乎无法建立连接:
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”的第一次机会异常
但除此之外,我没有得到更多的错误详细信息。
发布于 2013-07-20 08:31:13
您是否验证了ElasticSearch工作正常?
我知道所有示例都使用端口9200,而您使用的是端口52009。
如果您浏览到
http://localhost:52009/你可以看到下面的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"
}https://stackoverflow.com/questions/17752809
复制相似问题