在 NEST C# 中验证 Elasticsearch 查询字符串

Validation of Elasticsearch query string in NEST C#

我们正在从 Elasticsearch 5.6 迁移到 es 7.5。与这次迁移一起,我们也在迁移 NEST 库。

在 5.6 中,我们使用这样的验证:

...

Nest.ElasticClient client = ...
Nest.QueryContainer query = ...

client.ValidateQuery<T>(v => v.Query(q => query));

但根据 this document,所有验证查询的方法都已从 7.x 库中删除,并且没有关于如何在这种情况下使用 NEST 客户端的信息。

有什么方法可以使用 Nest.ElasticClient 来验证我们的查询吗?

它已移至客户端方法的 Indices 部分。

client.Indices.ValidateQuery(..)

希望对您有所帮助。