NEST 7.X DateHistogram Interval已被废弃,建议的替代方案返回400。

问题描述 投票:0回答:1

我开始用NEST 7.x查询ES,DateHistogram有一个警告信息。间隔 属性,因为它被废弃了。

下面是工作正常的代码,尽管我在Visual Studio中收到了关于废弃的 Interval

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

VS提供了另外两个选项,分别是 CalendarIntervalFixedInterval使用其中任何一种,都会有400个反应

远程服务器返回一个错误。(400) Bad Request... 调用。状态码400来自:POST qa-reporting-20202A_search?typed_keys=true。ServerError.Type: illegal_argument_exception: 类型: illegal_argument_exception 原因:"[date_histogram] 。未知字段[日历间隔],解析器未找到"--> System.Net.WebException: 远程服务器返回一个错误。(400) Bad Request

你知道会有什么解决办法吗?

c# elasticsearch nest
1个回答
0
投票

我看到在Kibana中查询ES时也不能工作。这将是由于旧版本的ES不知道这个新的选项,如这里所提到的 https:/www.elastic.coguideenelasticsearchreferencecurrentsearch-aggregations-bucket-datehistogram-aggregation.html

© www.soinside.com 2019 - 2024. All rights reserved.