New to ElasticSearch. I've seen a couple posts with similar titles but didn't seem to apply to me. I'm having trouble querying my ES cluster for the first time. Someone else creaed the cluster and gave me login info.
My code looks like this:
var settings = new ConnectionSettings(new Uri("server"))
.BasicAuthentication("user", "pw")
.DefaultIndex("index");
var client = new ElasticClient(settings);
var searchResponse = client.Search<mdl.Event>(s => s
.Query(q => q
.QueryString(qs => qs
.Query("Hello"))
&& q
.DateRange(r => r
.Field(f => f.CreatedTimeStamp)
.GreaterThanOrEquals(search.From)
.LessThanOrEquals(search.To))));
Console.Write(searchResponse);
I am getting no errors with this code. Only when I have the Console.Write statement I included do I get any detail. It reads:
Invalid NEST response built from a unsuccessful () low level call on POST: /index/_search?typed_keys=true
I'm not sure what is going wrong here. Is there an issue with the index or a quick fix to this issue?
It's hard to say what caused this but the SearchResponse object includes some properties you can inspect during debugging and/or log which will help identify the cause.
The most useful to start with are:
if (!searchResponse.IsValid)
{
// Handle errors
var debugInfo = searchResponse.DebugInformation;
var error = searchResponse.ServerError.Error;
}
IsValid will be false if the request failed for some reason.
DebugInformationis a string and includes the audit trail for the request. You can enable extra details in the configuration by enabling Debug Mode.
The ServerError property returns an object you can inspect to find various details from the server which may explain why a search failed.
I hope that answers your question and helps you debug a bit further.
I've returned the debug information - it reads like this:
The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code unknown from: GET / ---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Interop+AppleCrypto+SslException: misc. bad certificate
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.