【发布时间】:2014-03-11 15:57:53
【问题描述】:
已解决: URI 不正确。是“h||p://#.#.#.#/:9200”,应该是“h||p://#.#.#.#:9200”。这导致 API 将端口号更改为 80。令人惊讶的是 API 居然能够使用错误的端口号连接到 ElasticSearch 实例。
我是 NEST 和 ElasticSearch 的新手,正在尝试在 NEST 中组合一个简单的 MatchAll 查询。
当我从 Sense 执行 MatchAll 时
POST /movies/movie/_search
{
"query": {
"match_all": {}
}
}
我得到了电影索引中的所有电影对象。
但是当我尝试 NEST 查询时
var result = client.Search(s => s.Type("movie").MatchAll());
我一无所获。尝试将返回类型设置为电影类,仍然没有结果。
public class Movie
{
public string title { get; set; }
public string director { get; set; }
public int year { get; set; }
public List<string> genres { get; set; }
}
还根据此回复尝试了 .AllIndices() 和/或 .AllTypes() Searching an elasticsearch index with NEST yields no results
有什么想法吗?
编辑: 这是设置默认索引的连接字符串。
ConnectionSettings connection = new ConnectionSettings(uri).UsePrettyResponses().SetDefaultIndex("movies");
【问题讨论】:
标签: c# .net elasticsearch nest