NEST search -> String was not recognized as a valid DateTime


(Alberto Gonzalez) #1

i have been using this NEST search for months and has been working great, but now i am getting this error and doesnt return any document. I guess some new document has a invalid timestamp value but why one corrupt document makes everything fails?

ERRROR:
Elasticsearch.Net.UnexpectedElasticsearchClientException: 'String was not recognized as a valid DateTime.'

QUERY:
var result = elk.Search(x => x
.From(0)
.Index("alerts-*")
.AllTypes()
.Size(Settings.n_docs)
.Query(q =>
q.QueryString(qs => qs.Query(query_string)))
.Sort(ss => ss.Descending(p => p.timestamp))
);

AlertDto

public class UebAlertDto
{
public DateTime timestamp { get; set; }
public DateTime created { get; set; }
public int id { get; set; }
public string message { get; set; }
}

If i convert created to string it returns docs, so looks like some document has a created invalid, how can i find the incorrect ones or make NEST ignore them and return good ones?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.