NiFi EvaluateJsonPath 数组长度

Chi*_*hak 2 json jsonpath apache-nifi json-path-expression

我有以下 JSON:

{
    "hits": {
         "hits":[]
    }
}
Run Code Online (Sandbox Code Playgroud)

(ElasticSearch 的一些回应)。

我想使用处理器EvaluateJsonPath来获取 的长度hits.hits

我尝试了以下表达式:

$.hits.hits.length

但我收到以下错误:

FlowFile could not find path $['hits']['hits']['length'] for attribute key hits.:(这是错误的结束)。

然而,当使用 JsonEvaluate 网站在线检查时,它似乎有效。

我的表情怎么了?

Chi*_*hak 6

好像有不同的版本JsonPath。对我来说,$.hits.hits.length()工作了。