Reputation: 128
Am new to Elastic search and NEST, I am trying to get connected with my ES server through NEST. My ES Connection initialization looks like below.
ElasticClient client = null;
public void Connect()
{
var local = new Uri("http://192.168.40.95:9200/");
var settings = new ConnectionSettings(local).DisableDirectStreaming();
client = new ElasticClient(settings);
settings.DefaultIndex("gisgcc18q4");
ReadAllData();
}
public void ReadAllData()
{
var x= client.Search<dynamic>(s=> s.MatchAll());
}
The response is attached as image below,
I am Never getting any Hits, or data. Did i made any mistake in my connector, Also please suggest me good tutorials to convert JSOn ES query to NEST as well.
Upvotes: 0
Views: 559
Reputation: 125488
Looking at the Uri in the screenshot
POST /gisgcc18q4/object/_search?typed_keys=true
suggests that you're using a version older than 7, such as 5 or 6, where document types are used. In this case, the document type name "object"
has been inferred from the dynamic
type passed as the generic parameter argument, but I suspect that documents have not been indexed with a document type name of "object"
, but something else.
If the index "gisgcc18q4" only contains one type of document, you can use
var x = client.Search<dynamic>(s=> s.MatchAll().AllTypes());
Or you can pass the specific document type name to use
var x = client.Search<dynamic>(s=> s.MatchAll().Type("_doc"));
A good getting started tutorial for the client is the elasticsearch-net-example GitHub repository. It is a walkthrough in building out a ASP.NET Core web application to search Nuget packages.
Upvotes: 1
Reputation: 299
Your connection looks fine, can you please validate the detailed summary under DebugInfrormation by clicking on it and get the row query and response.
After apply same query on Postman.
Please copy and paste below expression on quick watch window on the same line which is displayed in your screenshot.
((Elasticsearch.Net.ApiCallDetails)response.ApiCall).DebugInformation
You will get the detailed information, it will be helpful for you to investigate this issue.
Upvotes: 1