elasticsearch NiFi:QueryLasticsSearchHTTP:使用表达式语言匹配对象?
我有一个NiFi流,我通过API引入一些数据,我很容易将其路由到ElasticSearch 我还有第二个流程,需要使用处理器elasticsearch NiFi:QueryLasticsSearchHTTP:使用表达式语言匹配对象?,elasticsearch,apache-nifi,elasticsearch,Apache Nifi,我有一个NiFi流,我通过API引入一些数据,我很容易将其路由到ElasticSearch 我还有第二个流程,需要使用处理器querylasticsearch http。在该处理器中,我有一个JSON查询: { "query" : { "bool" : { "must" : [ { "match" : { "Example1" : ${Example1} } }, { "match"
querylasticsearch http
。在该处理器中,我有一个JSON查询:
{
"query" : {
"bool" : {
"must" : [
{ "match" : { "Example1" : ${Example1} } },
{ "match" : { "ExampleCode" : ${ExampleCode} } }
]
}
}
}
我试图匹配对象Example1
和ExampleCode
,并返回整个列。我已经尝试将表达式语言注入到查询中。不起作用,而且我找不到如何匹配整个对象的示例
我试着用这样的引号:“${}”
我得到一个错误:
ERROR [Timer-Driven Process Thread-7] ...from Elasticsearch due to
Elasticsearch returned code 400 with message Bad Request, transferring
flow file to failure:
org.apache.nifi.processors.elasticsearch.UnretryableException:
Elasticsearch returned code 400 with message Bad Request
属性也会正确路由,并显示在需要显示的位置
正确的格式是什么?谢谢您可以尝试使用
jsonquerylasticsearch
处理器。演示流程如下所示:
总流量
开始步骤
查询ES步骤
JSON查询
存储结果步骤
控制器服务
运行的输出:
$ cd /var/so_out
$ cat 17973351988502 | python -m json.tool
[
{
"_id": "o002",
"_index": "office",
"_score": 0.26742277,
"_source": {
"description": "Shows and events",
"name": "Tom",
"title": "Marketing Manager"
},
"_type": "doc"
}
]
谢谢我的问题实际上围绕着如何查询整个对象,或者如何附加对象/列。在这种情况下,
${}
不会返回任何内容。您可以提供两件事吗?(1) Elasticsearch中的索引文档(2)直接针对Elasticsearch运行并返回结果的查询。