I am running a simple query through the ElasticSearch NEST C# client. I receive results when I run the same query through http, but I get zero documents returned from the client.
This is how I populated the data set:
curl -X POST "http://localhost:9200/blog/posts" -d @blog.json
This POST request returns a JSON result:
http://localhost:9200/_search?q=adipiscing
This is the code I have that is not returning anything.
public class Connector
{
private readonly ConnectionSettings _settings;
private readonly ElasticClient _client;
public Connector()
{
_settings = new ConnectionSettings("localhost", 9200);
_settings.SetDefaultIndex("blog");
_client = new ElasticClient(_settings);
}
public IEnumerable<BlogEntry> Search(string q)
{
var result =
_client.Search<BlogEntry>(s => s.QueryString(q));
return result.Documents.ToList();
}
}
What am I missing? Thanks in advance ..