已解决: URI不正确。是“h || p://#.#.#.#/:9200”,应该是“h || p://#.#.#.#:9200”。这导致API将端口号更改为80.令人惊讶的是,API实际上能够使用不正确的端口号连接到ElasticSearch实例。ElasticSearch和NEST查询问题
我是NEST和ElasticSearch的新手,尝试在NEST中放置一个简单的MatchAll查询。
当我从感
POST /movies/movie/_search
{
"query": {
"match_all": {}
}
}
我得到了电影指数中的所有影片对象进行MatchAll。
但是当我尝试了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()和/或每此回复 Searching an elasticsearch index with NEST yields no results
任何想法.AllTypes()?
编辑: 继承人连接字符串设置默认索引。
ConnectionSettings connection = new ConnectionSettings(uri).UsePrettyResponses().SetDefaultIndex("movies");
感谢您的回复Martijn。 Intersting IsValid()方法实际上是在IQueryResponse对象中,而不是像文档状态那样的ElasticClient。 http://nest.azurewebsites.net/concepts/connecting.html – user19055