NEST7.X DateHistogram Interval已弃用,建议的替代方法返回400



我从NEST 7.x开始查询ES,由于弃用,DateHistograminterval属性出现警告消息。

以下代码运行良好,尽管我在Visual Studio中收到了关于Interval弃用的警告消息

.Aggregations(ag=>ag
.DateHistogram("daily",g=>g
.Field("Created")
.Interval(DateInterval.Day)
))

VS提供另外两个选项,即CalendarIntervalFixedInterval使用它们中的任何一个都会导致400响应

远程服务器返回错误:(400(错误请求。。呼叫:状态代码400来自:POST/qa-reporting-20%2A/_search?typed_keys=true。服务器错误:类型:illegal_argument_exception原因:"[date_histogram]未知字段[calendar_interval],找不到分析器"--->System.Net.WebException:远程服务器返回错误:(400(错误的请求

您知道解决方案是什么吗?

当查询ES时,我发现它在Kibana中也不起作用。这将是由于旧版本的ES不知道这里提到的这个新选项https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html

最新更新