0
如何确保elasticsearch中索引的每个文档获取时间戳?将时间戳添加到ElasticSearch中添加的每个文档 - 嵌套2.0
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")
- 使用NEST和C#我如何确保每个文档我Index获取时间戳?
- 如何在一个小时前查询类型为
<MyDoc>
的所有文档?
我发现这一点:Adding Timestamp to each document added in ElasticSearch 但它不告诉我如何与NEST做到这一点
我试过这个,但是看结果时间戳为空,它返回所有文件的索引:
var test =
elasticClient.Search<MyDoc>(
s => s.Query(q => q.DateRange(x => x.LessThan(DateTime.Now.AddHours(-1)))));