How can I make sure each document indexed in elasticsearch gets timestamped?
node = new Uri("http://localhost:9201);
settings =
new ConnectionSettings(node).DefaultIndex("mytestindex");
elasticClient = new ElasticClient(settings);
// Then I do
elasticClient.Index(connections, idx => idx.Id("1")
- Using NEST and C# how can I make sure each document I index gets timestamp?
- How can I query for all documents of type
<MyDoc>
with older than an hour ago?
I found this: Adding Timestamp to each document added in ElasticSearch however it doesn't show me how to do this with NEST
I've tried this, however looking at the result timestamp is null and it returns all documents in index:
var test =
elasticClient.Search<MyDoc>(
s => s.Query(q => q.DateRange(x => x.LessThan(DateTime.Now.AddHours(-1)))));