0
string author = "John Smith";
下使用NEST拉姆達查詢NEST TermQuery工作:
string firstname = author.Split().First().ToLower();
var searchResults = client.Search<Magazine>(s => s.From(0).Size(5000).Query(q => q.Term(p => p.Author, author)));
但是,使用OIS(對象初始化語法)相同的查詢不起作用:
author = author.Split().First().ToLower();
QueryContainer query = new TermQuery
{
Field = "Author",
Value = author
};
var searchRequest = new SearchRequest
{
From = 0,
Size = 10,
Query = query
};
var searchResults = client.Search<Magazine>(searchRequest);
出了什麼問題?
這應該會幫助你http://stackoverflow.com/questions/28312465/elasticsearch-nest-library-wired-behavior/28333375 – Rob 2015-04-02 18:21:07